home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / asm / XZN-ST03IntroS.lha / St03 / play.s < prev    next >
Text File  |  1989-05-09  |  48KB  |  2,831 lines

  1.  
  2. **    $Filename: Player61.i $
  3. **    $Release: 6.1A $
  4. **    $Revision: 610.2 $
  5. **    $Date: 95/06/22 $
  6. **
  7. **    The Player 6.1A definitions
  8. **
  9. **    (C) Copyright 1992-94 Jarno Paananen
  10. **    All Rights Reserved
  11. **
  12.  
  13. lev6 =    1    ;0 = NonLev6 (non implementato)
  14.         ;1 = Lev6 used
  15.  
  16. channels = 4    ;amount of channels to be played
  17.  
  18.  
  19. STRUCTURE   MACRO        ; structure name, initial offset
  20. \1        EQU     0
  21. SOFFSET     SET     \2
  22.         ENDM
  23.  
  24. UBYTE        MACRO        ; unsigned byte (8 bits)
  25. \1        EQU     SOFFSET
  26. SOFFSET     SET     SOFFSET+1
  27.         ENDM
  28.  
  29. UWORD        MACRO        ; unsigned word (16 bits)
  30. \1        EQU     SOFFSET
  31. SOFFSET     SET     SOFFSET+2
  32.         ENDM
  33.  
  34. ULONG        MACRO        ; unsigned long (32 bits)
  35. \1        EQU     SOFFSET
  36. SOFFSET     SET     SOFFSET+4
  37.         ENDM
  38.  
  39. APTR        MACRO        ; untyped pointer (32 bits - all bits valid)
  40. \1        EQU     SOFFSET
  41. SOFFSET     SET     SOFFSET+4
  42.         ENDM
  43.  
  44. LABEL        MACRO        ; Define a label without bumping the offset
  45. \1        EQU     SOFFSET
  46.         ENDM
  47.  
  48. **************
  49. * The header *
  50. **************
  51.  
  52.   STRUCTURE Player_Header,0
  53. ** Instructions to jump to P61_Init
  54.     ULONG    P61_InitOffset
  55. ** ... to P61_Music (rts, if CIA-Version)
  56.     ULONG    P61_MusicOffset
  57. ** ... to P61_End
  58.     ULONG    P61_EndOffset
  59. ** ... to P61_SetRepeat (if present, otherwise rts)
  60.     ULONG    P61_SetRepeatOffset
  61. ** ... to P61_SetPosition
  62.     ULONG    P61_SetPositionOffset
  63. ** Master volume (used if told to...)
  64.     UWORD    P61_MasterVolume
  65. ** If non-zero, tempo will be used
  66.     UWORD    P61_UseTempo
  67. ** If zero, playing is stopped
  68.     UWORD    P61_PlayFlag
  69. ** Info nybble after command E8
  70.     UWORD    P61_E8_info
  71. ** Vector Base Register VBR passed to the player (default 0)
  72.     APTR    P61_UseVBR
  73. ** Current song position
  74.     UWORD    P61_Position
  75. ** Current pattern
  76.     UWORD    P61_Pattern
  77. ** Current row
  78.     UWORD    P61_Row
  79. ** Offset to channel 0 block from the beginning
  80.     APTR    P61_Cha0Offset
  81. ** Offset to channel 1 block from the beginning
  82.     APTR    P61_Cha1Offset
  83. ** Offset to channel 2 block from the beginning
  84.     APTR    P61_Cha2Offset
  85. ** Offset to channel 3 block from the beginning
  86.     APTR    P61_Cha3Offset
  87.  
  88.     LABEL Player_Header_SIZE
  89.  
  90.  
  91. *********************************************************
  92. ** The structure of the channel blocks (P61_Temp[0-3]) **
  93. *********************************************************
  94.  
  95.   STRUCTURE Channel_Block,0
  96.  
  97. ** Note and the MSB of the sample number
  98.     UBYTE    P61_SN_Note
  99. ** Lower nybble of the sample number and the command
  100.     UBYTE    P61_Command
  101. ** Info byte
  102.     UBYTE    P61_Info
  103. ** Packing info
  104.     UBYTE    P61_Pack
  105. ** Pointer to the sample block of the current sample
  106.     APTR    P61_Sample
  107. ** Current note (offset to the period table)
  108.     UWORD    P61_Note
  109. ** Period
  110.     UWORD    P61_Period
  111. ** Volume (NOT updated in tremolo!)
  112.     UWORD    P61_Volume
  113. ** Current finetune
  114.     UWORD    P61_Fine
  115. ** Sample offset
  116.     UWORD    P61_Offset
  117. ** Last sample Offset
  118.     UWORD    P61_LOffset
  119. ** To period for tone portamento
  120.     UWORD    P61_ToPeriod
  121. ** Speed for tone portamento
  122.     UWORD    P61_TPSpeed
  123. ** Vibrato command
  124.     UBYTE    P61_VibCmd
  125. ** Vibrato position
  126.     UBYTE    P61_VibPos
  127. ** Tremolo command
  128.     UBYTE    P61_TreCmd
  129. ** Tremolo position
  130.     UBYTE    P61_TrePos
  131. ** Retrig note counter
  132.     UWORD    P61_RetrigCount
  133.  
  134. ** Invert loop speed
  135.     UBYTE    P61_Funkspd
  136. ** Invert loop offset
  137.     UBYTE    P61_Funkoff
  138. ** Invert loop offset
  139.     APTR    P61_Wave
  140.  
  141. ** Internal switch to the packing
  142.     UWORD    P61_OnOff
  143. ** Pointer to the current pattern data
  144.     APTR    P61_ChaPos
  145. ** A packing pointer to data elsewhere in the pattern data
  146.     APTR    P61_TempPos
  147. ** Lenght of the temporary positions
  148.     UWORD    P61_TempLen
  149. ** Temp pointers for patternloop
  150.     UWORD    P61_TData
  151.     APTR    P61_TChaPos
  152.     APTR    P61_TTempPos
  153.     UWORD    P61_TTempLen
  154.  
  155. ** Shadow address for fading (updated also in tremolo!)
  156.     UWORD    P61_Shadow
  157.  
  158. ** Bit in DMACON ($DFF096)
  159.     UWORD    P61_DMABit
  160.  
  161.     LABEL Channel_Block_SIZE
  162.  
  163.  
  164.  
  165. ************************************************
  166. ** The structure of the sample block that     **
  167. ** the Player does at the init to P61_Samples **
  168. ************************************************
  169.  
  170.   STRUCTURE Sample_Block,0
  171.  
  172. ** Pointer to the beginning of the sample
  173.     APTR    P61_SampleOffset
  174. ** Lenght of the sample
  175.     UWORD    P61_SampleLength
  176. ** Pointer to the repeat
  177.     APTR    P61_RepeatOffset
  178. ** Lenght of the repeat
  179.     UWORD    P61_RepeatLength
  180. ** Volume of the sample
  181.     UWORD    P61_SampleVolume
  182. ** Finetune (offset to the period table)
  183.     UWORD    P61_FineTune
  184.  
  185.     LABEL Sample_Block_SIZE
  186.  
  187. ************************************************
  188. ** Some internal stuff for the Usecode-system **
  189. ************************************************
  190.  
  191.  
  192. ** if finetune is used
  193. P61_ft = use&1
  194. ** portamento up
  195. P61_pu = use&2
  196. ** portamento down
  197. P61_pd = use&4
  198. ** tone portamento
  199. P61_tp = use&40
  200. ** vibrato
  201. P61_vib = use&80
  202. ** tone portamento and volume slide
  203. P61_tpvs = use&32
  204. ** vibrato and volume slide
  205. P61_vbvs = use&64
  206. ** tremolo
  207. P61_tre = use&$80
  208. ** arpeggio
  209. P61_arp = use&$100
  210. ** sample offset
  211. P61_sof = use&$200
  212. ** volume slide
  213. P61_vs = use&$400
  214. ** position jump
  215. P61_pj = use&$800
  216. ** set volume
  217. P61_vl = use&$1000
  218. ** pattern break
  219. P61_pb = use&$2800
  220. ** set speed
  221. P61_sd = use&$8000
  222.  
  223. ** E-commands
  224. P61_ec = use&$ffff0000
  225.  
  226. ** filter
  227. P61_fi = use&$10000
  228. ** fine slide up
  229. P61_fsu = use&$20000
  230. ** fine slide down
  231. P61_fsd = use&$40000
  232. ** set finetune
  233. P61_sft = use&$200000
  234. ** pattern loop
  235. P61_pl = use&$400000
  236. ** E8 for timing purposes
  237. P61_timing = use&$1000000
  238. ** retrig note
  239. P61_rt = use&$2000000
  240. ** fine volume slide up
  241. P61_fvu = use&$4000000
  242. ** fine volume slide down
  243. P61_fvd = use&$8000000
  244. ** note cut
  245. P61_nc = use&$10000000
  246. ** note delay
  247. P61_nd = use&$20000000
  248. ** pattern delay
  249. P61_pde = use&$40000000
  250. ** invert loop
  251. P61_il = use&$80000000
  252.  
  253. *-----------------------------------------------*
  254.  
  255.     printt    ""
  256.     printt    "Options used:"
  257.     printt    "-------------"
  258.     ifd    startP
  259. ;    printt    "Starting from position"
  260. ;    printv    startP
  261.     endc
  262.     ifne    fade
  263.     printt    "Mastervolume on"
  264.     else
  265.     printt    "Mastervolume off"
  266.     endc
  267.     ifne    system
  268.     printt    "System friendly"
  269.     else
  270.     printt    "System killer"
  271.     endc
  272.     ifne    CIA
  273.     printt    "CIA-tempo on"
  274.     else
  275.     printt    "CIA-tempo off"
  276.     endc
  277.     ifne    exec
  278.     printt    "ExecBase valid"
  279.     else
  280.     printt    "ExecBase invalid"
  281.     endc
  282.     ifne    lev6
  283.     printt    "Level 6 IRQ on"
  284.     else
  285. ;    printt    "Non-lev6 NOT IMPLEMENTED!"
  286.     if2
  287.     fail
  288.     endc
  289.     endc
  290.     ifne    opt020
  291.     printt    "MC68020 optimizations"
  292.     else
  293.     printt    "Normal MC68000 code"
  294.     endc
  295. ;    printt    "Channels:"
  296. ;    printv    channels
  297.     ifgt    channels-4
  298. ;    printt    "NO MORE THAN 4 CHANNELS!"
  299.     if2
  300.     fail
  301.     endc
  302.     endc
  303.     ifeq    channels
  304. ;    printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  305.     if2
  306.     fail
  307.     endc
  308.     endc
  309.     printt    "UseCode:"
  310.     printv    use
  311.  
  312. *-----------------------------------------------*
  313.  
  314. *********************************
  315. *        Player 6.1A ®        *
  316. *      All in one-version    *
  317. *        Version 610.2        *
  318. *   © 1992-95 Jarno Paananen    *
  319. *     All rights reserved    *
  320. *********************************
  321.  
  322.  
  323. ******** START OF BINARY FILE **************
  324. P61_motuuli
  325.  
  326. P61_Master    dc    64        ;Master volume (0-64)
  327. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  328. P61_Play    dc    1        ;Stop flag (0=stop)
  329. P61_E8        dc    0        ;Info nybble after command E8
  330. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  331.                     ;put VBR here! (Otherwise 0 assumed)
  332.                     ;You can also get VBR from here, if
  333.                     ;using exec-valid version
  334.  
  335. P61_Pos        dc    0        ;Current song position
  336. P61_Patt    dc    0        ;Current pattern
  337. P61_CRow    dc    0        ;Current pattern row
  338.  
  339. P61_Temp0Offset
  340.     dc.l    P61_temp0-P61_motuuli
  341. P61_Temp1Offset
  342.     dc.l    P61_temp1-P61_motuuli
  343. P61_Temp2Offset
  344.     dc.l    P61_temp2-P61_motuuli
  345. P61_Temp3Offset
  346.     dc.l    P61_temp3-P61_motuuli
  347.  
  348. P61_getnote    macro
  349.     moveq    #$7e,d0
  350.     and.b    (a5),d0
  351.     beq.b    .nonote
  352.     ifne    P61_vib
  353.     clr.b    P61_VibPos(a5)
  354.     endc
  355.     ifne    P61_tre
  356.     clr.b    P61_TrePos(a5)
  357.     endc
  358.  
  359.     ifne    P61_ft
  360.     add    P61_Fine(a5),d0
  361.     endc
  362.     move    d0,P61_Note(a5)
  363.     move    (a2,d0),P61_Period(a5)
  364.  
  365. .nonote
  366.     endm
  367.  
  368.     ifeq    system
  369.     ifne    CIA
  370. P61_intti
  371.     movem.l    d0-a6,-(sp)
  372.     tst.b    $bfdd00
  373.     lea    $dff000,a6
  374.     move    #$2000,$9c(a6)
  375.     move    #$fff,$180(a6)
  376.     bsr    P61_Music
  377.     move    #0,$180(a6)
  378.     movem.l    (sp)+,d0-a6
  379.     nop
  380.     rte
  381.     endc
  382.     endc
  383.  
  384.     ifne    system
  385. P61_lev6server
  386.     movem.l    d2-d7/a2-a6,-(sp)
  387.     lea    P61_timeron(pc),a0
  388.     tst    (a0)
  389.     beq.b    P61_ohi
  390.  
  391.     lea    $dff000,a6
  392.     move    P61_server(pc),d0
  393.     beq.b    P61_musica
  394.     subq    #1,d0
  395.     beq    P61_dmason
  396.     bra    P61_setrepeat
  397.  
  398. P61_musica
  399.     bsr    P61_Music
  400.  
  401. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  402.     moveq    #1,d0
  403.     rts
  404.     endc
  405.  
  406. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  407. ;­ Call P61_Init to initialize the playroutine    ­
  408. ;­ D0 --> Timer detection (for CIA-version)    ­
  409. ;­ A0 --> Address to the module            ­
  410. ;­ A1 --> Address to samples/0 if in the module    ­
  411. ;­ A2 --> Address to sample buffer        ­
  412. ;­ D0 <-- 0 if succeeded            ­
  413. ;­ A6 <-- $DFF000                ­
  414. ;­         Uses D0-A6            ­
  415. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  416.  
  417. P61_Init
  418.     cmp.l    #"P61A",(a0)+
  419.     beq.b    .modok
  420.     subq.l    #4,a0
  421.  
  422. .modok    basereg    P61_cn,a3
  423.  
  424.     ifne    CIA
  425.     move    d0,-(sp)
  426.     endc
  427.  
  428.     moveq    #0,d0
  429.     cmp.l    d0,a1
  430.     bne.b    .redirect
  431.  
  432.     move    (a0),d0
  433.     lea    (a0,d0.l),a1
  434. .redirect
  435.     move.l    a2,a6
  436.     lea    8(a0),a2
  437.     moveq    #$40,d0
  438.     and.b    3(a0),d0
  439.     bne.b    .buffer
  440.     move.l    a1,a6
  441.     subq.l    #4,a2
  442. .buffer
  443.  
  444.     lea    P61_cn(pc),a3
  445.     moveq    #$1f,d1
  446.     and.b    3(a0),d1
  447.     move.l    a0,-(sp)
  448.     lea    P61_samples(pc),a4
  449.     subq    #1,d1
  450.     moveq    #0,d4
  451. P61_lopos
  452.     move.l    a6,(a4)+
  453.     move    (a2)+,d4
  454.     bpl.b    P61_kook
  455.     neg    d4
  456.     lea    P61_samples-16(pc),a5
  457.     ifeq    opt020
  458.     asl    #4,d4
  459.     move.l    (a5,d4),d6
  460.     else
  461.     add    d4,d4
  462.     move.l    (a5,d4*8),d6
  463.     endc
  464.     move.l    d6,-4(a4)
  465.     move    4(a5,d4),d4
  466.     sub.l    d4,a6
  467.     sub.l    d4,a6
  468.     bra.b    P61_jatk
  469.  
  470. P61_kook
  471.     move.l    a6,d6
  472.     tst.b    3(a0)
  473.     bpl.b    P61_jatk
  474.  
  475.     tst.b    (a2)
  476.     bmi.b    P61_jatk
  477.  
  478.     move    d4,d0
  479.     subq    #2,d0
  480.     bmi.b    P61_jatk
  481.  
  482.     move.l    a1,a5
  483.     move.b    (a5)+,d2
  484.     sub.b    (a5),d2
  485.     move.b    d2,(a5)+
  486. .loop    sub.b    (a5),d2
  487.     move.b    d2,(a5)+
  488.     sub.b    (a5),d2
  489.     move.b    d2,(a5)+
  490.     dbf    d0,.loop
  491.  
  492. P61_jatk
  493.     move    d4,(a4)+
  494.     moveq    #0,d2
  495.     move.b    (a2)+,d2
  496.     moveq    #0,d3
  497.     move.b    (a2)+,d3
  498.  
  499.     moveq    #0,d0
  500.     move    (a2)+,d0
  501.     bmi.b    .norepeat
  502.  
  503.     move    d4,d5
  504.     sub    d0,d5
  505.     move.l    d6,a5
  506.  
  507.     add.l    d0,a5
  508.     add.l    d0,a5
  509.  
  510.     move.l    a5,(a4)+
  511.     move    d5,(a4)+
  512.     bra.b    P61_gene
  513. .norepeat
  514.     move.l    d6,(a4)+
  515.     move    #1,(a4)+
  516. P61_gene
  517.     move    d3,(a4)+
  518.     moveq    #$f,d0
  519.     and    d2,d0
  520.     mulu    #74,d0
  521.     move    d0,(a4)+
  522.  
  523.     tst    -6(a2)
  524.     bmi.b    .nobuffer
  525.  
  526.     moveq    #$40,d0
  527.     and.b    3(a0),d0
  528.     beq.b    .nobuffer
  529.  
  530.     move    d4,d7
  531.     tst.b    d2
  532.     bpl.b    .copy
  533.  
  534.     subq    #1,d7
  535.     moveq    #0,d5
  536.     moveq    #0,d4
  537. .lo    move.b    (a1)+,d4
  538.     moveq    #$f,d3
  539.     and    d4,d3
  540.     lsr    #4,d4
  541.  
  542.     sub.b    .table(pc,d4),d5
  543.     move.b    d5,(a6)+
  544.     sub.b    .table(pc,d3),d5
  545.     move.b    d5,(a6)+
  546.     dbf    d7,.lo
  547.     bra.b    .kop
  548.  
  549. .copy    add    d7,d7
  550.     subq    #1,d7
  551. .cob    move.b    (a1)+,(a6)+
  552.     dbf    d7,.cob
  553.     bra.b    .kop
  554.  
  555. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  556.  
  557. .nobuffer
  558.     move.l    d4,d6
  559.     add.l    d6,d6
  560.     add.l    d6,a6
  561.     add.l    d6,a1
  562. .kop    dbf    d1,P61_lopos
  563.  
  564.     move.l    (sp)+,a0
  565.     and.b    #$7f,3(a0)
  566.  
  567.     move.l    a2,-(sp)
  568.  
  569.     lea    P61_temp0(pc),a1
  570.     lea    P61_temp1(pc),a2
  571.     lea    P61_temp2(pc),a4
  572.     lea    P61_temp3(pc),a5
  573.     moveq    #Channel_Block_SIZE/2-2,d0
  574.  
  575.     moveq    #0,d1
  576. .cl    move    d1,(a1)+
  577.     move    d1,(a2)+
  578.     move    d1,(a4)+
  579.     move    d1,(a5)+
  580.     dbf    d0,.cl
  581.  
  582.     lea    P61_temp0(a3),a1
  583.     lea    P61_emptysample(a3),a2
  584.     moveq    #channels-1,d0
  585. .l    move.l    a2,P61_Sample(a2)
  586.     dbf    d0,.l
  587.  
  588.     move.l    (sp)+,a2
  589.     move.l    a2,P61_positionbase(a3)
  590.  
  591.     moveq    #$7f,d1
  592.     and.b    2(a0),d1
  593.  
  594.     ifeq    opt020
  595.     lsl    #3,d1
  596.     lea    (a2,d1.l),a4
  597.     else
  598.     lea    (a2,d1.l*8),a4
  599.     endc
  600.     move.l    a4,P61_possibase(a3)
  601.  
  602.     move.l    a4,a1
  603.     moveq    #-1,d0
  604. .search    cmp.b    (a1)+,d0
  605.     bne.b    .search
  606.     move.l    a1,P61_patternbase(a3)    
  607.     move.l    a1,d0
  608.     sub.l    a4,d0
  609.     move    d0,P61_slen(a3)
  610.  
  611.     ifd    startP
  612.     lea    startP(a4),a4
  613.     endc
  614.  
  615.     moveq    #0,d0
  616.     move.b    (a4)+,d0
  617.     move.l    a4,P61_spos(a3)
  618.     lsl    #3,d0
  619.     add.l    d0,a2
  620.  
  621.     move.l    a1,a4
  622.     moveq    #0,d0    
  623.     move    (a2)+,d0
  624.     lea    (a4,d0.l),a1
  625.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  626.     move    (a2)+,d0
  627.     lea    (a4,d0.l),a1
  628.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  629.     move    (a2)+,d0
  630.     lea    (a4,d0.l),a1
  631.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  632.     move    (a2)+,d0
  633.     lea    (a4,d0.l),a1
  634.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  635.  
  636.     lea    P61_setrepeat(pc),a0
  637.     move.l    a0,P61_intaddr(a3)
  638.  
  639.     move    #63,P61_rowpos(a3)
  640.     move    #6,P61_speed(a3)
  641.     move    #5,P61_speed2(a3)
  642.     clr    P61_speedis1(a3)
  643.  
  644.     ifne    P61_pl
  645.     clr.l    P61_plcount(a3)
  646.     endc
  647.  
  648.     ifne    P61_pde
  649.     clr    P61_pdelay(a3)
  650.     clr    P61_pdflag(a3)
  651.     endc
  652.     clr    (a3)
  653.  
  654.     moveq    #2,d0
  655.     and.b    $bfe001,d0
  656.     move.b    d0,P61_ofilter(a3)
  657.     bset    #1,$bfe001
  658.  
  659.     ifeq    system
  660.     ifne    exec
  661.     move.l    4.w,a6
  662.     moveq    #0,d0
  663.     btst    d0,297(a6)
  664.     beq.b    .no68010
  665.  
  666.     lea    P61_liko(pc),a5
  667.     jsr    -$1e(a6)
  668.  
  669. .no68010
  670.     move.l    d0,P61_VBR(a3)
  671.     endc
  672.  
  673.     move.l    P61_VBR(a3),a0
  674.     lea    $78(a0),a0
  675.     move.l    a0,P61_vektori(a3)
  676.  
  677.     move.l    (a0),P61_oldlev6(a3)
  678.     lea    P61_dmason(pc),a1
  679.     move.l    a1,(a0)
  680.     endc
  681.  
  682.     moveq    #0,d0
  683.     lea    $dff000,a6
  684.     move    d0,$a8(a6)
  685.     move    d0,$b8(a6)
  686.     move    d0,$c8(a6)
  687.     move    d0,$d8(a6)
  688.     move    #$f,$96(a6)
  689.  
  690.     ifeq    system
  691.     lea    P61_dmason(pc),a1
  692.     move.l    a1,(a0)
  693.     move    #$2000,$9a(a6)
  694.     lea    $bfd000,a0
  695.     lea    P61_timers(pc),a1
  696.     move.b    #$7f,$d00(a0)
  697.     move.b    #$10,$e00(a0)
  698.     move.b    #$10,$f00(a0)
  699.     move.b    $400(a0),(a1)+
  700.     move.b    $500(a0),(a1)+
  701.     move.b    $600(a0),(a1)+
  702.     move.b    $700(a0),(a1)
  703.     endc
  704.  
  705.     ifeq    system!CIA
  706.     move.b    #$82,$d00(a0)
  707.     endc
  708.  
  709.     ifne    CIA
  710.     move    (sp)+,d0
  711.     subq    #1,d0
  712.     beq.b    P61_ForcePAL
  713.     subq    #1,d0
  714.     beq.b    P61_NTSC
  715.     ifne    exec
  716.     move.l    4.w,a1
  717.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  718.     beq.b    P61_NTSC
  719.     endc
  720. P61_ForcePAL
  721.     move.l    #1773447,d0    ;PAL
  722.     bra.b    P61_setcia
  723. P61_NTSC
  724.     move.l    #1789773,d0    ;NTSC
  725. P61_setcia
  726.     move.l    d0,P61_timer(a3)
  727.     divu    #125,d0
  728.     move    d0,P61_thi2(a3)
  729.     sub    #$1f0*2,d0
  730.     move    d0,P61_thi(a3)
  731.  
  732.     ifeq    system
  733.     move    P61_thi2(a3),d0
  734.     move.b    d0,$400(a0)
  735.     lsr    #8,d0
  736.     move.b    d0,$500(a0)
  737.     lea    P61_intti(pc),a1
  738.     move.l    a1,P61_tintti(a3)
  739.     move.l    P61_vektori(pc),a2
  740.     move.l    a1,(a2)
  741.     move.b    #$83,$d00(a0)
  742.     move.b    #$11,$e00(a0)
  743.     endc
  744.     endc
  745.  
  746.     ifeq    system
  747.     move    #$e000,$9a(a6)
  748.     moveq    #0,d0
  749.     rts
  750.  
  751.     ifne    exec
  752. P61_liko
  753.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  754.     rte
  755.     endc
  756.     endc
  757.  
  758.     ifne    system
  759.     move.l    a6,-(sp)
  760.  
  761.     ifne    CIA
  762.     clr    P61_server(a3)
  763.     else
  764.     move    #1,P61_server(a3)
  765.     endc
  766.  
  767.     move.l    4.w,a6
  768.     moveq    #-1,d0
  769.     jsr    -$14a(a6)
  770.     move.b    d0,P61_sigbit(a3)
  771.     bmi    P61_err
  772.  
  773.     lea    P61_allocport(pc),a1
  774.     move.l    a1,P61_portti(a3)
  775.     move.b    d0,15(a1)
  776.     move.l    a1,-(sp)
  777.     suba.l    a1,a1
  778.     jsr    -$126(a6)
  779.     move.l    (sp)+,a1
  780.     move.l    d0,16(a1)
  781.     lea    P61_reqlist(pc),a0
  782.     move.l    a0,(a0)
  783.     addq.l    #4,(a0)
  784.     clr.l    4(a0)
  785.     move.l    a0,8(a0)
  786.  
  787.     lea    P61_dat(pc),a1
  788.     move.l    a1,P61_reqdata(a3)
  789.     lea    P61_allocreq(pc),a1
  790.     lea    P61_audiodev(pc),a0
  791.     moveq    #0,d0
  792.     moveq    #0,d1
  793.     jsr    -$1bc(a6)
  794.     tst.l    d0
  795.     bne    P61_err
  796.     st.b    P61_audioopen(a3)
  797.  
  798.     lea    P61_timerint(pc),a1
  799.     move.l    a1,P61_timerdata(a3)
  800.     lea    P61_lev6server(pc),a1
  801.     move.l    a1,P61_timerdata+8(a3)
  802.  
  803.     moveq    #0,d3
  804.     lea    P61_cianame(pc),a1
  805. P61_openciares
  806.     moveq    #0,d0
  807.     move.l    4.w,a6
  808.     jsr    -$1f2(a6)
  809.     move.l    d0,P61_ciares(a3)
  810.     beq.b    P61_err
  811.     move.l    d0,a6
  812.     lea    P61_timerinterrupt(pc),a1
  813.     moveq    #0,d0
  814.     jsr    -6(a6)
  815.     tst.l    d0
  816.     beq.b    P61_gottimer
  817.     addq.l    #4,d3
  818.     lea    P61_timerinterrupt(pc),a1
  819.     moveq    #1,d0
  820.     jsr    -6(a6)
  821.     tst.l    d0
  822.     bne.b    P61_err
  823.  
  824. P61_gottimer
  825.     lea    P61_craddr+8(pc),a6
  826.     move.l    P61_ciaaddr(pc,d3),d0
  827.     move.l    d0,(a6)
  828.     sub    #$100,d0
  829.     move.l    d0,-(a6)
  830.     moveq    #2,d3
  831.     btst    #9,d0
  832.     bne.b    P61_timerB
  833.     subq.b    #1,d3
  834.     add    #$100,d0
  835. P61_timerB
  836.     add    #$900,d0
  837.     move.l    d0,-(a6)
  838.     move.l    d0,a0
  839.     and.b    #%10000000,(a0)
  840.     move.b    d3,P61_timeropen(a3)
  841.     moveq    #0,d0
  842.     ifne    CIA
  843.     move.l    P61_craddr+4(pc),a1
  844.     move.b    P61_tlo(pc),(a1)
  845.     move.b    P61_thi(pc),$100(a1)
  846.     endc
  847.     or.b    #$19,(a0)
  848.     st    P61_timeron(a3)
  849. P61_pois
  850.     move.l    (sp)+,a6
  851.     rts
  852.  
  853. P61_err    moveq    #-1,d0
  854.     bra.b    P61_pois
  855.     rts
  856.  
  857. P61_ciaaddr
  858.     dc.l    $bfd500,$bfd700
  859.     endc
  860.  
  861. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  862. ;­         Call P61_End to stop the music        ­
  863. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  864. ;­        Uses D0/D1/A0/A1/A3        ­
  865. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  866.  
  867. P61_End    moveq    #0,d0
  868.     move    d0,$a8(a6)
  869.     move    d0,$b8(a6)
  870.     move    d0,$c8(a6)
  871.     move    d0,$d8(a6)
  872.     move    #$f,$96(a6)
  873.  
  874.     and.b    #~2,$bfe001
  875.     move.b    P61_ofilter(pc),d0
  876.     or.b    d0,$bfe001
  877.  
  878.     ifeq    system
  879.     move    #$2000,$9a(a6)
  880.     move.l    P61_vektori(pc),a0
  881.     move.l    P61_oldlev6(pc),(a0)
  882.     lea    $bfd000,a0
  883.     lea    P61_timers(pc),a1
  884.     move.b    (a1)+,$400(a0)
  885.     move.b    (a1)+,$500(a0)
  886.     move.b    (a1)+,$600(a0)
  887.     move.b    (a1)+,$700(a0)
  888.     move.b    #$10,$e00(a0)
  889.     move.b    #$10,$f00(a0)
  890.  
  891.     else
  892.  
  893.     clr    P61_timeron(a3)
  894.     move.l    a6,-(sp)
  895.     lea    P61_cn(pc),a3
  896.     moveq    #0,d0
  897.     move.b    P61_timeropen(pc),d0
  898.     beq.b    P61_rem1
  899.     move.l    P61_ciares(pc),a6
  900.     lea    P61_timerinterrupt(pc),a1
  901.     subq.b    #1,d0
  902.     jsr    -12(a6)
  903. P61_rem1
  904.     move.l    4.w,a6
  905.     tst.b    P61_audioopen(a3)
  906.     beq.b    P61_rem2
  907.     lea    P61_allocreq(pc),a1
  908.     jsr    -$1c2(a6)
  909.     clr.b    P61_audioopen(a3)
  910. P61_rem2
  911.     moveq    #0,d0
  912.     move.b    P61_sigbit(pc),d0
  913.     bmi.b    P61_rem3
  914.     jsr    -$150(a6)
  915.     st    P61_sigbit(a3)
  916. P61_rem3
  917.     move.l    (sp)+,a6
  918.     endc
  919.     rts
  920.  
  921.     ifne    fade
  922. P61_mfade
  923.     move    P61_Master(pc),d0
  924.     move    P61_temp0+P61_Shadow(pc),d1
  925.     mulu    d0,d1
  926.     lsr    #6,d1
  927.     move    d1,$a8(a6)
  928.  
  929.     ifgt    channels-1
  930.     move    P61_temp1+P61_Shadow(pc),d1
  931.     mulu    d0,d1
  932.     lsr    #6,d1
  933.     move    d1,$b8(a6)
  934.     endc
  935.  
  936.     ifgt    channels-2
  937.     move    P61_temp2+P61_Shadow(pc),d1
  938.     mulu    d0,d1
  939.     lsr    #6,d1
  940.     move    d1,$c8(a6)
  941.     endc
  942.  
  943.     ifgt    channels-3
  944.     move    P61_temp3+P61_Shadow(pc),d1
  945.     mulu    d0,d1
  946.     lsr    #6,d1
  947.     move    d1,$d8(a6)
  948.     endc
  949.     rts
  950.     endc
  951.     
  952.  
  953. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  954. ;­ Call P61_SetPosition to jump to a specific    ­
  955. ;­          position in the song.        ­
  956. ;­ D0.l --> Position                ­
  957. ;­ Starts from the beginning if out of limits.    ­
  958. ;­              Uses A0/A1/A3/D0-D3        ­
  959. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  960.  
  961.     ifne    jump
  962. P61_SetPosition
  963.     lea    P61_cn(pc),a3
  964.     ifne    P61_pl
  965.     clr    P61_plflag(a3)
  966.     endc
  967.     moveq    #0,d1
  968.     move.b    d0,d1
  969.     move.l    d1,d0
  970.     cmp    P61_slen(a3),d0
  971.     blo.b    .e
  972.     moveq    #0,d0
  973. .e    move    d0,P61_Pos(a3)
  974.     add.l    P61_possibase(pc),d0
  975.     move.l    d0,P61_spos(a3)
  976.  
  977.     moveq    #64,d0
  978.     move    d0,P61_rowpos(a3)
  979.     clr    P61_CRow(a3)
  980.     move.l    P61_spos(pc),a1
  981.     move.l    P61_patternbase(pc),a0
  982.     addq    #1,P61_Pos(a3)
  983.     move.b    (a1)+,d0
  984.     move.l    a1,P61_spos(a3)
  985.     move.l    P61_positionbase(pc),a1
  986.     move    d0,P61_Patt(a3)
  987.     lsl    #3,d0
  988.     add.l    d0,a1
  989.     movem    (a1),d0-d3
  990.     lea    (a0,d0.l),a1
  991.     move    d1,d0
  992.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  993.     lea    (a0,d0.l),a1
  994.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  995.     move    d2,d0
  996.     lea    (a0,d0.l),a1
  997.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  998.     move    d3,d0
  999.     add.l    d0,a0
  1000.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1001.     rts
  1002.     endc
  1003.  
  1004. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  1005. ;­ Call P61_Music every frame to play the music    ­
  1006. ;­      _NOT_ if CIA-version is used!        ­
  1007. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  1008. ;­              Uses A0-A5/D0-D7        ­
  1009. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  1010.  
  1011. P61_Music
  1012.     lea    P61_cn(pc),a3
  1013.  
  1014.     tst    P61_Play(a3)
  1015.     bne.b    P61_ohitaaa
  1016.     ifne    CIA
  1017.     ifne    system
  1018.     move.l    P61_craddr+4(pc),a0
  1019.     move.b    P61_tlo2(pc),(a0)
  1020.     move.b    P61_thi2(pc),$100(a0)
  1021.     endc
  1022.     endc
  1023.     rts
  1024.  
  1025. P61_ohitaaa
  1026.     ifne    fade
  1027.     pea    P61_mfade(pc)
  1028.     endc
  1029.  
  1030.     moveq    #Channel_Block_SIZE,d6
  1031.     moveq    #16,d7
  1032.  
  1033.     move    (a3),d4
  1034.     addq    #1,d4
  1035.     cmp    P61_speed(pc),d4
  1036.     beq    P61_playtime
  1037.  
  1038.     move    d4,(a3)
  1039.  
  1040. P61_delay
  1041.     ifne    CIA
  1042.     ifne    system
  1043.     move.l    P61_craddr+4(pc),a0
  1044.     move.b    P61_tlo2(pc),(a0)
  1045.     move.b    P61_thi2(pc),$100(a0)
  1046.     endc
  1047.     endc
  1048.  
  1049.     lea    P61_temp0(pc),a5
  1050.     lea    $a0(a6),a4
  1051.  
  1052.     moveq    #channels-1,d5
  1053. P61_lopas
  1054.     tst    P61_OnOff(a5)
  1055.     beq    P61_contfxdone
  1056.     moveq    #$f,d0
  1057.     and    (a5),d0
  1058.     ifeq    opt020
  1059.     add    d0,d0
  1060.     move    P61_jtab2(pc,d0),d0
  1061.     else
  1062.     move    P61_jtab2(pc,d0*2),d0
  1063.     endc
  1064.     jmp    P61_jtab2(pc,d0)
  1065.  
  1066. P61_jtab2
  1067.     dc    P61_contfxdone-P61_jtab2
  1068.  
  1069.     ifne    P61_pu
  1070.     dc    P61_portup-P61_jtab2
  1071.     else
  1072.     dc    P61_contfxdone-P61_jtab2
  1073.     endc
  1074.  
  1075.     ifne    P61_pd
  1076.     dc    P61_portdwn-P61_jtab2
  1077.     else
  1078.     dc    P61_contfxdone-P61_jtab2
  1079.     endc
  1080.  
  1081.     ifne    P61_tp
  1082.     dc    P61_toneport-P61_jtab2
  1083.     else
  1084.     dc    P61_contfxdone-P61_jtab2
  1085.     endc
  1086.  
  1087.     ifne    P61_vib
  1088.     dc    P61_vib2-P61_jtab2
  1089.     else
  1090.     dc    P61_contfxdone-P61_jtab2
  1091.     endc
  1092.  
  1093.     ifne    P61_tpvs
  1094.     dc    P61_tpochvslide-P61_jtab2
  1095.     else
  1096.     dc    P61_contfxdone-P61_jtab2
  1097.     endc
  1098.  
  1099.     ifne    P61_vbvs
  1100.     dc    P61_vibochvslide-P61_jtab2
  1101.     else
  1102.     dc    P61_contfxdone-P61_jtab2
  1103.     endc
  1104.  
  1105.     ifne    P61_tre
  1106.     dc    P61_tremo-P61_jtab2
  1107.     else
  1108.     dc    P61_contfxdone-P61_jtab2
  1109.     endc
  1110.  
  1111.     ifne    P61_arp
  1112.     dc    P61_arpeggio-P61_jtab2
  1113.     else
  1114.     dc    P61_contfxdone-P61_jtab2
  1115.     endc
  1116.  
  1117.     dc    P61_contfxdone-P61_jtab2
  1118.  
  1119.     ifne    P61_vs
  1120.     dc    P61_volslide-P61_jtab2
  1121.     else
  1122.     dc    P61_contfxdone-P61_jtab2
  1123.     endc
  1124.  
  1125.     dc    P61_contfxdone-P61_jtab2
  1126.     dc    P61_contfxdone-P61_jtab2
  1127.     dc    P61_contfxdone-P61_jtab2
  1128.  
  1129.     ifne    P61_ec
  1130.     dc    P61_contecommands-P61_jtab2
  1131.     else
  1132.     dc    P61_contfxdone-P61_jtab2
  1133.     endc
  1134.     dc    P61_contfxdone-P61_jtab2
  1135.  
  1136.     ifne    P61_ec
  1137. P61_contecommands
  1138.     move.b    P61_Info(a5),d0
  1139.     and    #$f0,d0
  1140.     lsr    #3,d0
  1141.     move    P61_etab2(pc,d0),d0
  1142.     jmp    P61_etab2(pc,d0)
  1143.  
  1144. P61_etab2
  1145.     dc    P61_contfxdone-P61_etab2
  1146.  
  1147.     ifne    P61_fsu
  1148.     dc    P61_fineup2-P61_etab2
  1149.     else
  1150.     dc    P61_contfxdone-P61_etab2
  1151.     endc
  1152.  
  1153.     ifne    P61_fsd
  1154.     dc    P61_finedwn2-P61_etab2
  1155.     else
  1156.     dc    P61_contfxdone-P61_etab2
  1157.     endc
  1158.  
  1159.     dc    P61_contfxdone-P61_etab2
  1160.     dc    P61_contfxdone-P61_etab2
  1161.  
  1162.     dc    P61_contfxdone-P61_etab2
  1163.     dc    P61_contfxdone-P61_etab2
  1164.  
  1165.     dc    P61_contfxdone-P61_etab2
  1166.     dc    P61_contfxdone-P61_etab2
  1167.  
  1168.     ifne    P61_rt
  1169.     dc    P61_retrig-P61_etab2
  1170.     else
  1171.     dc    P61_contfxdone-P61_etab2
  1172.     endc
  1173.  
  1174.     ifne    P61_fvu
  1175.     dc    P61_finevup2-P61_etab2
  1176.     else
  1177.     dc    P61_contfxdone-P61_etab2
  1178.     endc
  1179.  
  1180.     ifne    P61_fvd
  1181.     dc    P61_finevdwn2-P61_etab2
  1182.     else
  1183.     dc    P61_contfxdone-P61_etab2
  1184.     endc
  1185.  
  1186.     ifne    P61_nc
  1187.     dc    P61_notecut-P61_etab2
  1188.     else
  1189.     dc    P61_contfxdone-P61_etab2
  1190.     endc
  1191.  
  1192.     ifne    P61_nd
  1193.     dc    P61_notedelay-P61_etab2
  1194.     else
  1195.     dc    P61_contfxdone-P61_etab2
  1196.     endc
  1197.  
  1198.     dc    P61_contfxdone-P61_etab2
  1199.     dc    P61_contfxdone-P61_etab2
  1200.     endc
  1201.  
  1202.     ifne    P61_fsu
  1203. P61_fineup2
  1204.     tst    (a3)
  1205.     bne    P61_contfxdone
  1206.     moveq    #$f,d0
  1207.     and.b    P61_Info(a5),d0
  1208.     sub    d0,P61_Period(a5)
  1209.     moveq    #113,d0
  1210.     cmp    P61_Period(a5),d0
  1211.     ble.b    .jup
  1212.     move    d0,P61_Period(a5)
  1213. .jup    move    P61_Period(a5),6(a4)
  1214.     bra    P61_contfxdone
  1215.     endc
  1216.  
  1217.     ifne    P61_fsd
  1218. P61_finedwn2
  1219.     tst    (a3)
  1220.     bne    P61_contfxdone
  1221.     moveq    #$f,d0
  1222.     and.b    P61_Info(a5),d0
  1223.     add    d0,P61_Period(a5)
  1224.     cmp    #856,P61_Period(a5)
  1225.     ble.b    .jup
  1226.     move    #856,P61_Period(a5)
  1227. .jup    move    P61_Period(a5),6(a4)
  1228.     bra    P61_contfxdone
  1229.     endc
  1230.  
  1231.     ifne    P61_fvu
  1232. P61_finevup2
  1233.     tst    (a3)
  1234.     bne    P61_contfxdone
  1235.     moveq    #$f,d0
  1236.     and.b    P61_Info(a5),d0
  1237.     add    d0,P61_Volume(a5)
  1238.     moveq    #64,d0
  1239.     cmp    P61_Volume(a5),d0
  1240.     bge.b    .jup
  1241.     move    d0,P61_Volume(a5)
  1242. .jup    move    P61_Volume(a5),8(a4)
  1243.     bra    P61_contfxdone
  1244.     endc
  1245.  
  1246.     ifne    P61_fvd
  1247. P61_finevdwn2
  1248.     tst    (a3)
  1249.     bne    P61_contfxdone
  1250.     moveq    #$f,d0
  1251.     and.b    P61_Info(a5),d0
  1252.     sub    d0,P61_Volume(a5)
  1253.     bpl.b    .jup
  1254.     clr    P61_Volume(a5)
  1255. .jup    move    P61_Volume(a5),8(a4)
  1256.     bra    P61_contfxdone
  1257.     endc
  1258.  
  1259.     ifne    P61_nc
  1260. P61_notecut
  1261.     moveq    #$f,d0
  1262.     and.b    P61_Info(a5),d0
  1263.     cmp    (a3),d0
  1264.     bne    P61_contfxdone
  1265.     ifeq    fade
  1266.     clr    8(a4)
  1267.     else
  1268.     clr    P61_Shadow(a5)
  1269.     endc
  1270.     clr    P61_Volume(a5)
  1271.     bra    P61_contfxdone
  1272.     endc
  1273.  
  1274.     ifne    P61_nd
  1275. P61_notedelay
  1276.     moveq    #$f,d0
  1277.     and.b    P61_Info(a5),d0
  1278.     cmp    (a3),d0
  1279.     bne    P61_contfxdone
  1280.  
  1281.     moveq    #$7e,d0
  1282.     and.b    (a5),d0
  1283.     beq    P61_contfxdone
  1284.     move    P61_DMABit(a5),d0
  1285.     move    d0,$96(a6)
  1286.     or    d0,P61_dma(a3)
  1287.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1288.     move.l    (a1)+,(a4)+            ;Pointer
  1289.     move    (a1),(a4)+            ;Length
  1290.     move    P61_Period(a5),(a4)
  1291.     subq.l    #6,a4
  1292.  
  1293.     ifeq    system
  1294.     lea    P61_dmason(pc),a1
  1295.     move.l    P61_vektori(pc),a0
  1296.     move.l    a1,(a0)
  1297.     move.b    #$f0,$bfd600
  1298.     move.b    #$01,$bfd700
  1299.     move.b    #$19,$bfdf00
  1300.     else
  1301.     move    #1,P61_server(a3)
  1302.     move.l    P61_craddr+4(pc),a1
  1303.     move.b    #$f0,(a1)
  1304.     move.b    #1,$100(a1)
  1305.     endc
  1306.     bra    P61_contfxdone
  1307.     endc
  1308.  
  1309.     ifne    P61_rt
  1310. P61_retrig
  1311.     subq    #1,P61_RetrigCount(a5)
  1312.     bne    P61_contfxdone
  1313.     move    P61_DMABit(a5),d0
  1314.     move    d0,$96(a6)
  1315.     or    d0,P61_dma(a3)
  1316.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1317.     move.l    (a1)+,(a4)            ;Pointer
  1318.     move    (a1),4(a4)            ;Length
  1319.  
  1320.     ifeq    system
  1321.     lea    P61_dmason(pc),a1
  1322.     move.l    P61_vektori(pc),a0
  1323.     move.l    a1,(a0)
  1324.     move.b    #$f0,$bfd600
  1325.     move.b    #$01,$bfd700
  1326.     move.b    #$19,$bfdf00
  1327.     else
  1328.     move    #1,P61_server(a3)
  1329.     move.l    P61_craddr+4(pc),a1
  1330.     move.b    #$f0,(a1)
  1331.     move.b    #1,$100(a1)
  1332.     endc
  1333.  
  1334.     moveq    #$f,d0
  1335.     and.b    P61_Info(a5),d0
  1336.     move    d0,P61_RetrigCount(a5)
  1337.     bra    P61_contfxdone
  1338.     endc
  1339.  
  1340.     ifne    P61_arp
  1341. P61_arplist
  1342.  dc.b 0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1
  1343.  
  1344. P61_arpeggio
  1345.     move    (a3),d0
  1346.     move.b    P61_arplist(pc,d0),d0
  1347.     beq.b    .arp0
  1348.     bmi.b    .arp1
  1349.  
  1350.     move.b    P61_Info(a5),d0
  1351.     lsr    #4,d0
  1352.     bra.b    .arp3
  1353.  
  1354. .arp0    move    P61_Note(a5),d0
  1355.     move    P61_periods(pc,d0),6(a4)
  1356.     bra    P61_contfxdone
  1357.  
  1358. .arp1    moveq    #$f,d0
  1359.     and.b    P61_Info(a5),d0
  1360.  
  1361. .arp3    add    d0,d0
  1362.     add    P61_Note(a5),d0
  1363.     move    P61_periods(pc,d0),6(a4)
  1364.     bra    P61_contfxdone
  1365.     endc
  1366.  
  1367. P61_periods
  1368.     ifne    P61_ft
  1369.  
  1370.     dc.w    $358,$358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A
  1371.     dc.w    $1FC,$1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E
  1372.     dc.w    $11D,$10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97
  1373.     dc.w    $8F,$87,$7F,$78,$71,$352,$352,$322,$2F5,$2CB,$2A2
  1374.     dc.w    $27D,$259,$237,$217,$1F9,$1DD,$1C2,$1A9,$191,$17B
  1375.     dc.w    $165,$151,$13E,$12C,$11C,$10C,$FD,$EF,$E1,$D5,$C9
  1376.     dc.w    $BD,$B3,$A9,$9F,$96,$8E,$86,$7E,$77,$71,$34C,$34C
  1377.     dc.w    $31C,$2F0,$2C5,$29E,$278,$255,$233,$214,$1F6,$1DA
  1378.     dc.w    $1BF,$1A6,$18E,$178,$163,$14F,$13C,$12A,$11A,$10A
  1379.     dc.w    $FB,$ED,$E0,$D3,$C7,$BC,$B1,$A7,$9E,$95,$8D,$85
  1380.     dc.w    $7D,$76,$70,$346,$346,$317,$2EA,$2C0,$299,$274
  1381.     dc.w    $250,$22F,$210,$1F2,$1D6,$1BC,$1A3,$18B,$175,$160
  1382.     dc.w    $14C,$13A,$128,$118,$108,$F9,$EB,$DE,$D1,$C6,$BB
  1383.     dc.w    $B0,$A6,$9D,$94,$8C,$84,$7D,$76,$6F,$340,$340
  1384.     dc.w    $311,$2E5,$2BB,$294,$26F,$24C,$22B,$20C,$1EF,$1D3
  1385.     dc.w    $1B9,$1A0,$188,$172,$15E,$14A,$138,$126,$116,$106
  1386.     dc.w    $F7,$E9,$DC,$D0,$C4,$B9,$AF,$A5,$9C,$93,$8B,$83
  1387.     dc.w    $7C,$75,$6E,$33A,$33A,$30B,$2E0,$2B6,$28F,$26B
  1388.     dc.w    $248,$227,$208,$1EB,$1CF,$1B5,$19D,$186,$170,$15B
  1389.     dc.w    $148,$135,$124,$114,$104,$F5,$E8,$DB,$CE,$C3,$B8
  1390.     dc.w    $AE,$A4,$9B,$92,$8A,$82,$7B,$74,$6D,$334,$334
  1391.     dc.w    $306,$2DA,$2B1,$28B,$266,$244,$223,$204,$1E7,$1CC
  1392.     dc.w    $1B2,$19A,$183,$16D,$159,$145,$133,$122,$112,$102
  1393.     dc.w    $F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$9A,$91,$89,$81
  1394.     dc.w    $7A,$73,$6D,$32E,$32E,$300,$2D5,$2AC,$286,$262
  1395.     dc.w    $23F,$21F,$201,$1E4,$1C9,$1AF,$197,$180,$16B,$156
  1396.     dc.w    $143,$131,$120,$110,$100,$F2,$E4,$D8,$CC,$C0,$B5
  1397.     dc.w    $AB,$A1,$98,$90,$88,$80,$79,$72,$6C,$38B,$38B
  1398.     dc.w    $358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A,$1FC
  1399.     dc.w    $1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E,$11D
  1400.     dc.w    $10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97,$8F
  1401.     dc.w    $87,$7F,$78,$384,$384,$352,$322,$2F5,$2CB,$2A3
  1402.     dc.w    $27C,$259,$237,$217,$1F9,$1DD,$1C2,$1A9,$191,$17B
  1403.     dc.w    $165,$151,$13E,$12C,$11C,$10C,$FD,$EE,$E1,$D4,$C8
  1404.     dc.w    $BD,$B3,$A9,$9F,$96,$8E,$86,$7E,$77,$37E,$37E
  1405.     dc.w    $34C,$31C,$2F0,$2C5,$29E,$278,$255,$233,$214,$1F6
  1406.     dc.w    $1DA,$1BF,$1A6,$18E,$178,$163,$14F,$13C,$12A,$11A
  1407.     dc.w    $10A,$FB,$ED,$DF,$D3,$C7,$BC,$B1,$A7,$9E,$95,$8D
  1408.     dc.w    $85,$7D,$76,$377,$377,$346,$317,$2EA,$2C0,$299
  1409.     dc.w    $274,$250,$22F,$210,$1F2,$1D6,$1BC,$1A3,$18B,$175
  1410.     dc.w    $160,$14C,$13A,$128,$118,$108,$F9,$EB,$DE,$D1,$C6
  1411.     dc.w    $BB,$B0,$A6,$9D,$94,$8C,$84,$7D,$76,$371,$371
  1412.     dc.w    $340,$311,$2E5,$2BB,$294,$26F,$24C,$22B,$20C,$1EE
  1413.     dc.w    $1D3,$1B9,$1A0,$188,$172,$15E,$14A,$138,$126,$116
  1414.     dc.w    $106,$F7,$E9,$DC,$D0,$C4,$B9,$AF,$A5,$9C,$93,$8B
  1415.     dc.w    $83,$7B,$75,$36B,$36B,$33A,$30B,$2E0,$2B6,$28F
  1416.     dc.w    $26B,$248,$227,$208,$1EB,$1CF,$1B5,$19D,$186,$170
  1417.     dc.w    $15B,$148,$135,$124,$114,$104,$F5,$E8,$DB,$CE,$C3
  1418.     dc.w    $B8,$AE,$A4,$9B,$92,$8A,$82,$7B,$74,$364,$364
  1419.     dc.w    $334,$306,$2DA,$2B1,$28B,$266,$244,$223,$204,$1E7
  1420.     dc.w    $1CC,$1B2,$19A,$183,$16D,$159,$145,$133,$122,$112
  1421.     dc.w    $102,$F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$9A,$91,$89
  1422.     dc.w    $81,$7A,$73,$35E,$35E,$32E,$300,$2D5,$2AC,$286
  1423.     dc.w    $262,$23F,$21F,$201,$1E4,$1C9,$1AF,$197,$180,$16B
  1424.     dc.w    $156,$143,$131,$120,$110,$100,$F2,$E4,$D8,$CB,$C0
  1425.     dc.w    $B5,$AB,$A1,$98,$90,$88,$80,$79,$72
  1426.  
  1427.     else
  1428.  
  1429.     dc.w    $358,$358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A
  1430.     dc.w    $1FC,$1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E
  1431.     dc.w    $11D,$10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97
  1432.     dc.w    $8F,$87,$7F,$78,$71
  1433.  
  1434.     endc
  1435.  
  1436.  
  1437.     ifne    P61_vs
  1438. P61_volslide
  1439.     move.b    P61_Info(a5),d0
  1440.     sub.b    d0,P61_Volume+1(a5)
  1441.     bpl.b    .test
  1442.     clr    P61_Volume(a5)
  1443.     ifeq    fade
  1444.     clr    8(a4)
  1445.     else
  1446.     clr    P61_Shadow(a5)
  1447.     endc
  1448.     bra    P61_contfxdone
  1449. .test    moveq    #64,d0
  1450.     cmp    P61_Volume(a5),d0
  1451.     bge.b    .ncs
  1452.     move    d0,P61_Volume(a5)
  1453.     ifeq    fade
  1454.     move    d0,8(a4)
  1455.     else
  1456.     move    d0,P61_Shadow(a5)
  1457.     endc
  1458.     bra.b    P61_contfxdone
  1459. .ncs    ifeq    fade
  1460.     move    P61_Volume(a5),8(a4)
  1461.     else
  1462.     move    P61_Volume(a5),P61_Shadow(a5)
  1463.     endc
  1464.     bra.b    P61_contfxdone
  1465.     endc
  1466.  
  1467.     ifne    P61_tpvs
  1468. P61_tpochvslide
  1469.     move.b    P61_Info(a5),d0
  1470.     sub.b    d0,P61_Volume+1(a5)
  1471.     bpl.b    .test
  1472.     clr    P61_Volume(a5)
  1473.     ifeq    fade
  1474.     clr    8(a4)
  1475.     else
  1476.     clr    P61_Shadow(a5)
  1477.     endc
  1478.     bra.b    P61_toneport
  1479. .test    moveq    #64,d0
  1480.     cmp    P61_Volume(a5),d0
  1481.     bge.b    .ncs
  1482.     move    d0,P61_Volume(a5)
  1483. .ncs    ifeq    fade
  1484.     move    P61_Volume(a5),8(a4)
  1485.     else
  1486.     move    P61_Volume(a5),P61_Shadow(a5)
  1487.     endc
  1488.     endc
  1489.  
  1490.     ifne    P61_tp
  1491. P61_toneport
  1492.     move    P61_ToPeriod(a5),d0
  1493.     beq.b    P61_contfxdone
  1494.     move    P61_TPSpeed(a5),d1
  1495.     cmp    P61_Period(a5),d0
  1496.     blt.b    .topoup
  1497.  
  1498.     add    d1,P61_Period(a5)
  1499.     cmp    P61_Period(a5),d0
  1500.     bgt.b    .setper
  1501.     move    d0,P61_Period(a5)
  1502.     clr    P61_ToPeriod(a5)
  1503.     move    d0,6(a4)
  1504.     bra.b    P61_contfxdone
  1505.  
  1506. .topoup
  1507.     sub    d1,P61_Period(a5)
  1508.     cmp    P61_Period(a5),d0
  1509.     blt.b    .setper
  1510.     move    d0,P61_Period(a5)
  1511.     clr    P61_ToPeriod(a5)
  1512. .setper
  1513.     move    P61_Period(a5),6(a4)
  1514.     else
  1515.     nop
  1516.     endc
  1517.  
  1518. P61_contfxdone
  1519.     ifne    P61_il
  1520.     bsr    P61_funk2
  1521.     endc
  1522.  
  1523.     add.l    d6,a5
  1524.     add.l    d7,a4
  1525.     dbf    d5,P61_lopas
  1526.  
  1527.     cmp    P61_speed2(pc),d4
  1528.     beq.b    P61_preplay
  1529.     rts
  1530.  
  1531.     ifne    P61_pu
  1532. P61_portup
  1533.     moveq    #0,D0
  1534.     move.b    P61_Info(a5),d0
  1535.     sub    d0,P61_Period(a5)
  1536.     moveq    #113,d0
  1537.     cmp    P61_Period(a5),d0
  1538.     ble.b    .skip
  1539.     move    d0,P61_Period(a5)
  1540.     move    d0,6(a4)
  1541.     bra.b    P61_contfxdone
  1542. .skip
  1543.     move    P61_Period(a5),6(a4)
  1544.     bra.b    P61_contfxdone
  1545.     endc
  1546.  
  1547.     ifne    P61_pd
  1548. P61_portdwn
  1549.     moveq    #0,d0
  1550.     move.b    P61_Info(a5),d0
  1551.     add    d0,P61_Period(a5)
  1552.     cmp    #856,P61_Period(a5)
  1553.     ble.b    .skip
  1554.     move    #856,d0
  1555.     move    d0,P61_Period(a5)
  1556.     move    d0,6(a4)
  1557.     bra.b    P61_contfxdone
  1558. .skip
  1559.     move    P61_Period(a5),6(a4)
  1560.     bra.b    P61_contfxdone
  1561.     endc
  1562.  
  1563.     ifne    P61_pde
  1564. P61_return
  1565.     rts
  1566.  
  1567. P61_preplay
  1568.     tst    P61_pdflag(a3)
  1569.     bne.b    P61_return
  1570.     else
  1571. P61_preplay
  1572.     endc
  1573.  
  1574.     lea    P61_temp0(pc),a5
  1575.     lea    P61_samples-16(pc),a0
  1576.  
  1577.     moveq    #channels-1,d5
  1578. P61_loaps
  1579.     ifne    P61_pl
  1580.     lea    P61_TData(a5),a1
  1581.     move    2(a5),(a1)+
  1582.     move.l    P61_ChaPos(a5),(a1)+
  1583.     move.l    P61_TempPos(a5),(a1)+
  1584.     move    P61_TempLen(a5),(a1)
  1585.     endc
  1586.  
  1587.     move.b    P61_Pack(a5),d0
  1588.     and.b    #$3f,d0
  1589.     beq.b    P61_takeone
  1590.  
  1591.     tst.b    P61_Pack(a5)
  1592.     bmi.b    .keepsame
  1593.  
  1594.     subq.b    #1,P61_Pack(a5)
  1595.     clr    P61_OnOff(a5)            ; Empty row
  1596.     add.l    d6,a5
  1597.     dbf    d5,P61_loaps
  1598.     rts
  1599.  
  1600. .keepsame
  1601.     subq.b    #1,P61_Pack(a5)
  1602.     bra    P61_dko
  1603.  
  1604. P61_takeone
  1605.     tst.b    P61_TempLen+1(a5)
  1606.     beq    P61_takenorm
  1607.  
  1608.     subq.b    #1,P61_TempLen+1(a5)
  1609.     move.l    P61_TempPos(a5),a2
  1610.  
  1611. P61_jedi
  1612.     move.b    (a2)+,d0
  1613.     moveq    #%01100000,d1
  1614.     and.b    d0,d1
  1615.     cmp.b    #%01100000,d1
  1616.     bne.b    .all
  1617.  
  1618.     moveq    #%01110000,d1
  1619.     and.b    d0,d1
  1620.     cmp.b    #%01110000,d1
  1621.     bne.b    .cmd
  1622.  
  1623.     moveq    #%01111000,d1
  1624.     and.b    d0,d1
  1625.     cmp.b    #%01111000,d1
  1626.     bne.b    .note
  1627.  
  1628. .empty    clr    P61_OnOff(a5)            ; Empty row
  1629.     clr    (a5)+
  1630.     clr.b    (a5)+
  1631.     tst.b    d0
  1632.     bpl.b    .ex
  1633.     move.b    (a2)+,(a5)            ; Compression info
  1634.     bra.b    .ex
  1635.  
  1636. .all    move.b    d0,(a5)+
  1637.     ifeq    opt020
  1638.     move.b    (a2)+,(a5)+
  1639.     move.b    (a2)+,(a5)+
  1640.     else
  1641.     move    (a2)+,(a5)+
  1642.     endc
  1643.     tst.b    d0
  1644.     bpl.b    .ex
  1645.     move.b    (a2)+,(a5)            ; Compression info
  1646.     bra.b    .ex
  1647.  
  1648. .cmd    moveq    #$f,d1
  1649.     and    d0,d1
  1650.     move    d1,(a5)+            ; cmd
  1651.     move.b    (a2)+,(a5)+            ; info
  1652.     tst.b    d0
  1653.     bpl.b    .ex
  1654.     move.b    (a2)+,(a5)            ; Compression info
  1655.     bra.b    .ex
  1656.  
  1657. .note    moveq    #7,d1
  1658.     and    d0,d1
  1659.     lsl    #8,d1
  1660.     move.b    (a2)+,d1
  1661.     lsl    #4,d1
  1662.     move    d1,(a5)+
  1663.     clr.b    (a5)+    
  1664.     tst.b    d0
  1665.     bpl.b    .ex
  1666.     move.b    (a2)+,(a5)            ; Compression info
  1667. .ex    subq.l    #3,a5
  1668.     move.l    a2,P61_TempPos(a5)
  1669.     bra    P61_dko
  1670.  
  1671.  
  1672. P61_takenorm
  1673.     move.l    P61_ChaPos(a5),a2
  1674.  
  1675.     move.b    (a2)+,d0
  1676.     moveq    #%01100000,d1
  1677.     and.b    d0,d1
  1678.     cmp.b    #%01100000,d1
  1679.     bne.b    .all
  1680.  
  1681.     moveq    #%01110000,d1
  1682.     and.b    d0,d1
  1683.     cmp.b    #%01110000,d1
  1684.     bne.b    .cmd
  1685.  
  1686.     moveq    #%01111000,d1
  1687.     and.b    d0,d1
  1688.     cmp.b    #%01111000,d1
  1689.     bne.b    .note
  1690.  
  1691. .empty    clr    P61_OnOff(a5)            ; Empty row
  1692.     clr    (a5)+
  1693.     clr.b    (a5)+
  1694.     tst.b    d0
  1695.     bpl.b    .proccomp
  1696.     move.b    (a2)+,(a5)            ; Compression info
  1697.     bra.b    .proccomp
  1698.  
  1699.  
  1700. .all    move.b    d0,(a5)+
  1701.     ifeq    opt020
  1702.     move.b    (a2)+,(a5)+
  1703.     move.b    (a2)+,(a5)+
  1704.     else
  1705.     move    (a2)+,(a5)+
  1706.     endc
  1707.     tst.b    d0
  1708.     bpl.b    .proccomp
  1709.     move.b    (a2)+,(a5)            ; Compression info
  1710.     bra.b    .proccomp
  1711.  
  1712. .cmd    moveq    #$f,d1
  1713.     and    d0,d1
  1714.     move    d1,(a5)+            ; cmd
  1715.     move.b    (a2)+,(a5)+            ; info
  1716.     tst.b    d0
  1717.     bpl.b    .proccomp
  1718.     move.b    (a2)+,(a5)            ; Compression info
  1719.     bra.b    .proccomp
  1720.  
  1721. .note    moveq    #7,d1
  1722.     and    d0,d1
  1723.     lsl    #8,d1
  1724.     move.b    (a2)+,d1
  1725.     lsl    #4,d1
  1726.     move    d1,(a5)+
  1727.     clr.b    (a5)+    
  1728.     tst.b    d0
  1729.     bpl.b    .proccomp
  1730.     move.b    (a2)+,(a5)            ; Compression info
  1731.  
  1732. .proccomp
  1733.     subq.l    #3,a5
  1734.     move.l    a2,P61_ChaPos(a5)
  1735.  
  1736.     tst.b    d0
  1737.     bpl.b    P61_dko
  1738.  
  1739.     move.b    3(a5),d0
  1740.     move.b    d0,d1
  1741.     and    #%11000000,d1
  1742.     beq.b    P61_dko                ; Empty datas
  1743.     cmp.b    #%10000000,d1
  1744.     beq.b    P61_dko                ; Same datas
  1745.  
  1746.     clr.b    3(a5)
  1747.     and    #$3f,d0
  1748.     move.b    d0,P61_TempLen+1(a5)
  1749.  
  1750.     cmp.b    #%11000000,d1
  1751.     beq.b    .bit16                ; 16-bit
  1752.  
  1753.     moveq    #0,d0                ; 8-bit
  1754.     move.b    (a2)+,d0
  1755.     move.l    a2,P61_ChaPos(a5)
  1756.     sub.l    d0,a2
  1757.     bra    P61_jedi
  1758.  
  1759. .bit16    moveq    #0,d0
  1760.     ifeq    opt020
  1761.     move.b    (a2)+,d0
  1762.     lsl    #8,d0
  1763.     move.b    (a2)+,d0
  1764.     else
  1765.     move    (a2)+,d0
  1766.     endc
  1767.  
  1768.     move.l    a2,P61_ChaPos(a5)
  1769.     sub.l    d0,a2
  1770.     bra    P61_jedi
  1771.  
  1772.  
  1773. P61_dko    st    P61_OnOff(a5)
  1774.     move    (a5),d0
  1775.     and    #$1f0,d0
  1776.     beq.b    .koto
  1777.     lea    (a0,d0),a1
  1778.     move.l    a1,P61_Sample(a5)
  1779.     ifne    P61_ft
  1780.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1781.     else
  1782.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1783.     endc
  1784.     ifne    P61_il
  1785.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1786.     endc
  1787.     ifne    P61_sof
  1788.     clr    P61_Offset(a5)
  1789.     endc
  1790.  
  1791. .koto    add.l    d6,a5
  1792.     dbf    d5,P61_loaps
  1793.     rts
  1794.  
  1795. P61_playtime
  1796.     clr    (a3)
  1797.  
  1798.     ifne    P61_pde
  1799.     tst    P61_pdelay(a3)
  1800.     beq.b    .djdj
  1801.     subq    #1,P61_pdelay(a3)
  1802.     bne    P61_delay
  1803.     tst    P61_speedis1(a3)
  1804.     bne    P61_delay
  1805.     clr    P61_pdflag(a3)
  1806.     bra    P61_delay
  1807. .djdj
  1808.     clr    P61_pdflag(a3)
  1809.     endc
  1810.  
  1811.     tst    P61_speedis1(a3)
  1812.     beq.b    .mo
  1813.     bsr    P61_preplay
  1814.  
  1815. .mo    lea    P61_temp0(pc),a5
  1816.     lea    $a0(a6),a4
  1817.  
  1818.     ifeq    system
  1819.     lea    P61_dmason(pc),a1
  1820.     move.l    P61_vektori(pc),a0
  1821.     move.l    a1,(a0)
  1822.     move.b    #$f0,$bfd600
  1823.     move.b    #$01,$bfd700
  1824.     move.b    #$19,$bfdf00
  1825.     else
  1826.     move    #1,P61_server(a3)
  1827.     move.l    P61_craddr+4(pc),a1
  1828.     move.b    #$f0,(a1)
  1829.     move.b    #1,$100(a1)
  1830.     endc
  1831.  
  1832.     lea    P61_periods(pc),a2
  1833.  
  1834.     moveq    #0,d4
  1835.     moveq    #channels-1,d5
  1836. P61_los    tst    P61_OnOff(a5)
  1837.     beq    P61_nocha
  1838.  
  1839.     moveq    #$f,d0
  1840.     and    (a5),d0
  1841.     lea    P61_jtab(pc),a1
  1842.     add    d0,d0
  1843.     add.l    d0,a1
  1844.     add    (a1),a1
  1845.     jmp    (a1)
  1846.  
  1847. P61_fxdone
  1848.     moveq    #$7e,d0
  1849.     and.b    (a5),d0
  1850.     beq.b    P61_nocha
  1851.     ifne    P61_vib
  1852.     clr.b    P61_VibPos(a5)
  1853.     endc
  1854.     ifne    P61_tre
  1855.     clr.b    P61_TrePos(a5)
  1856.     endc
  1857.  
  1858.      ifne    P61_ft
  1859.     add    P61_Fine(a5),d0
  1860.     endc
  1861.     move    d0,P61_Note(a5)
  1862.     move    (a2,d0),P61_Period(a5)
  1863.  
  1864. P61_zample
  1865.     ifne    P61_sof
  1866.     tst    P61_Offset(a5)
  1867.     bne    P61_pek
  1868.     endc
  1869.  
  1870.     or    P61_DMABit(a5),d4
  1871.     move    d4,$96(a6)
  1872.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1873.     move.l    (a1)+,(a4)            ;Pointer
  1874.     move    (a1),4(a4)            ;Length
  1875.  
  1876. P61_nocha
  1877.     ifeq    fade
  1878.     move.l    P61_Period(a5),6(a4)
  1879.     else
  1880.     move    P61_Period(a5),6(a4)
  1881.     move    P61_Volume(a5),P61_Shadow(a5)
  1882.     endc
  1883.  
  1884. P61_skip
  1885.     ifne    P61_il
  1886.     bsr    P61_funk2
  1887.     endc
  1888.  
  1889.     add.l    d6,a5
  1890.     add.l    d7,a4
  1891.     dbf    d5,P61_los
  1892.  
  1893.     move.b    d4,P61_dma+1(a3)
  1894.  
  1895.     ifne    P61_pl
  1896.     tst.b    P61_plflag+1(a3)
  1897.     beq.b    P61_ohittaa
  1898.  
  1899.     lea    P61_temp0(pc),a1
  1900.     lea    P61_looppos(pc),a0
  1901.     moveq    #channels-1,d0
  1902. .talt    move.b    1(a0),3(a1)
  1903.     addq.l    #2,a0
  1904.     move.l    (a0)+,P61_ChaPos(a1)
  1905.     move.l    (a0)+,P61_TempPos(a1)
  1906.     move    (a0)+,P61_TempLen(a1)
  1907.     add.l    d6,a1
  1908.     dbf    d0,.talt
  1909.  
  1910.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1911.     clr.b    P61_plflag+1(a3)
  1912.     moveq    #63,d0
  1913.     sub    P61_rowpos(a3),d0
  1914.     move    d0,P61_CRow(a3)
  1915.     rts
  1916.     endc
  1917.  
  1918. P61_ohittaa
  1919.     subq    #1,P61_rowpos(a3)
  1920.     bmi.b    P61_nextpattern
  1921.     moveq    #63,d0
  1922.     sub    P61_rowpos(a3),d0
  1923.     move    d0,P61_CRow(a3)
  1924.     rts
  1925.  
  1926. P61_nextpattern
  1927.     ifne    P61_pl
  1928.     clr    P61_plflag(a3)
  1929.     endc
  1930.     move.l    P61_patternbase(pc),a4
  1931.     moveq    #63,d0
  1932.     move    d0,P61_rowpos(a3)
  1933.     clr    P61_CRow(a3)
  1934.     move.l    P61_spos(pc),a1
  1935.     addq    #1,P61_Pos(a3)
  1936.     move.b    (a1)+,d0
  1937.     bpl.b    P61_dk
  1938.     move.l    P61_possibase(pc),a1
  1939.     move.b    (a1)+,d0
  1940.     clr    P61_Pos(a3)
  1941. P61_dk    move.l    a1,P61_spos(a3)
  1942.     move    d0,P61_Patt(a3)
  1943.     lsl    #3,d0
  1944.     move.l    P61_positionbase(pc),a1
  1945.     add.l    d0,a1
  1946.  
  1947.     move    (a1)+,d0
  1948.     lea    (a4,d0.l),a2
  1949.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1950.     move    (a1)+,d0
  1951.     lea    (a4,d0.l),a2
  1952.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1953.     move    (a1)+,d0
  1954.     lea    (a4,d0.l),a2
  1955.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1956.     move    (a1),d0
  1957.     add.l    d0,a4
  1958.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1959.     rts
  1960.  
  1961.     ifne    P61_tp
  1962. P61_settoneport
  1963.     move.b    P61_Info(a5),d0
  1964.     beq.b    P61_toponochange
  1965.     move.b    d0,P61_TPSpeed+1(a5)
  1966. P61_toponochange
  1967.     moveq    #$7e,d0
  1968.     and.b    (a5),d0
  1969.     beq    P61_nocha
  1970.     add    P61_Fine(a5),d0
  1971.     move    d0,P61_Note(a5)
  1972.     move    (a2,d0),P61_ToPeriod(a5)
  1973.     bra    P61_nocha
  1974.     endc
  1975.  
  1976.     ifne    P61_sof
  1977. P61_sampleoffse
  1978.     moveq    #0,d1
  1979.     move    #$ff00,d1
  1980.     and    2(a5),d1
  1981.     bne.b    .deq
  1982.     move    P61_LOffset(a5),d1
  1983. .deq    move    d1,P61_LOffset(a5)
  1984.     add    d1,P61_Offset(a5)
  1985.  
  1986.     moveq    #$7e,d0
  1987.     and.b    (a5),d0
  1988.     beq    P61_nocha
  1989.  
  1990.     move    P61_Offset(a5),d2
  1991.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1992.     move    d2,d1
  1993.  
  1994.     ifne    P61_vib
  1995.     clr.b    P61_VibPos(a5)
  1996.     endc
  1997.     ifne    P61_tre
  1998.     clr.b    P61_TrePos(a5)
  1999.     endc
  2000.  
  2001.     ifne    P61_ft
  2002.     add    P61_Fine(a5),d0
  2003.     endc
  2004.     move    d0,P61_Note(a5)
  2005.     move    (a2,d0),P61_Period(a5)
  2006.     bra.b    P61_hup
  2007.  
  2008. P61_pek    moveq    #0,d1
  2009.     move    P61_Offset(a5),d1
  2010. P61_hup    or    P61_DMABit(a5),d4
  2011.     move    d4,$96(a6)
  2012.     move.l    P61_Sample(a5),a1        ;* Trigger *
  2013.     move.l    (a1)+,d0
  2014.     add.l    d1,d0
  2015.     move.l    d0,(a4)                ;Pointer
  2016.     lsr    #1,d1
  2017.     move    (a1),d0
  2018.     sub    d1,d0
  2019.     bpl.b    P61_offok
  2020.     move.l    -4(a1),(a4)            ;Pointer is over the end
  2021.     moveq    #1,d0
  2022. P61_offok
  2023.     move    d0,4(a4)            ;Length
  2024.     bra    P61_nocha
  2025.     endc
  2026.  
  2027.     ifne    P61_vl
  2028. P61_volum
  2029.     move.b    P61_Info(a5),P61_Volume+1(a5)
  2030.     bra    P61_fxdone
  2031.     endc
  2032.  
  2033.     ifne    P61_pj
  2034. P61_posjmp
  2035.     moveq    #0,d0
  2036.     move.b    P61_Info(a5),d0
  2037.     cmp    P61_slen(a3),d0
  2038.     blo.b    .e
  2039.     moveq    #0,d0
  2040. .e    move    d0,P61_Pos(a3)
  2041.     add.l    P61_possibase(pc),d0
  2042.     move.l    d0,P61_spos(a3)
  2043.     endc
  2044.  
  2045.     ifne    P61_pb
  2046. P61_pattbreak
  2047.     moveq    #64,d0
  2048.     move    d0,P61_rowpos(a3)
  2049.     clr    P61_CRow(a3)
  2050.     move.l    P61_spos(pc),a1
  2051.     move.l    P61_patternbase(pc),a0
  2052.     addq    #1,P61_Pos(a3)
  2053.     move.b    (a1)+,d0
  2054.     bpl.b    P61_dk2
  2055.     move.l    P61_possibase(pc),a1
  2056.     move.b    (a1)+,d0
  2057.     clr    P61_Pos(a3)
  2058. P61_dk2    move.l    a1,P61_spos(a3)
  2059.     move.l    P61_positionbase(pc),a1
  2060.     move    d0,P61_Patt(a3)
  2061.     lsl    #3,d0
  2062.     add.l    d0,a1
  2063.     movem    (a1),d0-d3
  2064.     lea    (a0,d0.l),a1
  2065.     move    d1,d0
  2066.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  2067.     lea    (a0,d0.l),a1
  2068.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  2069.     move    d2,d0
  2070.     lea    (a0,d0.l),a1
  2071.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  2072.     move    d3,d0
  2073.     add.l    d0,a0
  2074.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  2075.     bra    P61_fxdone
  2076.     endc
  2077.  
  2078.     ifne    P61_vib
  2079. P61_vibrato
  2080.     move.b    P61_Info(a5),d0
  2081.     beq    P61_fxdone
  2082.     move.b    d0,d1
  2083.     move.b    P61_VibCmd(a5),d2
  2084.     and.b    #$f,d0
  2085.     beq.b    P61_vibskip
  2086.     and.b    #$f0,d2
  2087.     or.b    d0,d2
  2088. P61_vibskip
  2089.     and.b    #$f0,d1
  2090.     beq.b    P61_vibskip2
  2091.     and.b    #$f,d2
  2092.     or.b    d1,d2
  2093. P61_vibskip2
  2094.     move.b    d2,P61_VibCmd(a5)
  2095.     bra    P61_fxdone
  2096.     endc
  2097.  
  2098.     ifne    P61_tre
  2099. P61_settremo
  2100.     move.b    P61_Info(a5),d0
  2101.     beq    P61_fxdone
  2102.     move.b    d0,d1
  2103.     move.b    P61_TreCmd(a5),d2
  2104.     moveq    #$f,d3
  2105.     and.b    d3,d0
  2106.     beq.b    P61_treskip
  2107.     and.b    #$f0,d2
  2108.     or.b    d0,d2
  2109. P61_treskip
  2110.     and.b    #$f0,d1
  2111.     beq.b    P61_treskip2
  2112.     and.b    d3,d2
  2113.     or.b    d1,d2
  2114. P61_treskip2
  2115.     move.b    d2,P61_TreCmd(a5)
  2116.     bra    P61_fxdone
  2117.     endc
  2118.  
  2119.     ifne    P61_ec
  2120. P61_ecommands
  2121.     move.b    P61_Info(a5),d0
  2122.     and.b    #$f0,d0
  2123.     lsr    #3,d0
  2124.     move    P61_etab(pc,d0),d0
  2125.     jmp    P61_etab(pc,d0)
  2126.  
  2127. P61_etab
  2128.     ifne    P61_fi
  2129.     dc    P61_filter-P61_etab
  2130.     else
  2131.     dc    P61_fxdone-P61_etab
  2132.     endc
  2133.  
  2134.     ifne    P61_fsu
  2135.     dc    P61_fineup-P61_etab
  2136.     else
  2137.     dc    P61_fxdone-P61_etab
  2138.     endc
  2139.  
  2140.     ifne    P61_fsd
  2141.     dc    P61_finedwn-P61_etab
  2142.     else
  2143.     dc    P61_fxdone-P61_etab
  2144.     endc
  2145.  
  2146.     dc    P61_fxdone-P61_etab
  2147.     dc    P61_fxdone-P61_etab
  2148.  
  2149.     ifne    P61_sft
  2150.     dc    P61_setfinetune-P61_etab
  2151.     else
  2152.     dc    P61_fxdone-P61_etab
  2153.     endc
  2154.  
  2155.     ifne    P61_pl
  2156.     dc    P61_patternloop-P61_etab
  2157.     else
  2158.     dc    P61_fxdone-P61_etab
  2159.     endc
  2160.  
  2161.     dc    P61_fxdone-P61_etab
  2162.  
  2163.     ifne    P61_timing
  2164.     dc    P61_sete8-P61_etab
  2165.     else
  2166.     dc    P61_fxdone-P61_etab
  2167.     endc
  2168.  
  2169.     ifne    P61_rt
  2170.     dc    P61_setretrig-P61_etab
  2171.     else
  2172.     dc    P61_fxdone-P61_etab
  2173.     endc
  2174.  
  2175.     ifne    P61_fvu
  2176.     dc    P61_finevup-P61_etab
  2177.     else
  2178.     dc    P61_fxdone-P61_etab
  2179.     endc
  2180.  
  2181.     ifne    P61_fvd
  2182.     dc    P61_finevdwn-P61_etab
  2183.     else
  2184.     dc    P61_fxdone-P61_etab
  2185.     endc
  2186.  
  2187.     dc    P61_fxdone-P61_etab
  2188.  
  2189.     ifne    P61_nd
  2190.     dc    P61_ndelay-P61_etab
  2191.     else
  2192.     dc    P61_fxdone-P61_etab
  2193.     endc
  2194.  
  2195.     ifne    P61_pde
  2196.     dc    P61_pattdelay-P61_etab
  2197.     else
  2198.     dc    P61_fxdone-P61_etab
  2199.     endc
  2200.  
  2201.     ifne    P61_il
  2202.     dc    P61_funk-P61_etab
  2203.     else
  2204.     dc    P61_fxdone-P61_etab
  2205.     endc
  2206.     endc
  2207.  
  2208.     ifne    P61_fi
  2209. P61_filter
  2210.     move.b    P61_Info(a5),d0
  2211.     and.b    #$fd,$bfe001
  2212.     or.b    d0,$bfe001
  2213.     bra    P61_fxdone
  2214.     endc
  2215.  
  2216.     ifne    P61_fsu
  2217. P61_fineup
  2218.     P61_getnote
  2219.  
  2220.     moveq    #$f,d0
  2221.     and.b    P61_Info(a5),d0
  2222.     sub    d0,P61_Period(a5)
  2223.     moveq    #113,d0
  2224.     cmp    P61_Period(a5),d0
  2225.     ble.b    .jup
  2226.     move    d0,P61_Period(a5)
  2227. .jup    moveq    #$7e,d0
  2228.     and.b    (a5),d0
  2229.     bne    P61_zample
  2230.     bra    P61_nocha
  2231.     endc
  2232.  
  2233.     ifne    P61_fsd
  2234. P61_finedwn
  2235.     P61_getnote
  2236.  
  2237.     moveq    #$f,d0
  2238.     and.b    P61_Info(a5),d0
  2239.     add    d0,P61_Period(a5)
  2240.     cmp    #856,P61_Period(a5)
  2241.     ble.b    .jup
  2242.     move    #856,P61_Period(a5)
  2243. .jup    moveq    #$7e,d0
  2244.     and.b    (a5),d0
  2245.     bne    P61_zample
  2246.     bra    P61_nocha
  2247.     endc
  2248.  
  2249.     ifne    P61_sft
  2250. P61_setfinetune
  2251.     moveq    #$f,d0
  2252.     and.b    P61_Info(a5),d0
  2253.     ifeq    opt020
  2254.     add    d0,d0
  2255.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2256.     else
  2257.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2258.     endc
  2259.     bra    P61_fxdone
  2260.  
  2261. P61_mulutab
  2262.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2263.     endc
  2264.  
  2265.     ifne    P61_pl
  2266. P61_patternloop
  2267.     moveq    #$f,d0
  2268.     and.b    P61_Info(a5),d0
  2269.     beq.b    P61_setloop
  2270.  
  2271.     tst.b    P61_plflag(a3)
  2272.     bne.b    P61_noset
  2273.  
  2274.     move    d0,P61_plcount(a3)
  2275.     st.b    P61_plflag(a3)
  2276. P61_noset
  2277.     tst    P61_plcount(a3)
  2278.     bne.b    P61_looppaa
  2279.     clr.b    P61_plflag(a3)
  2280.     bra    P61_fxdone
  2281.     
  2282. P61_looppaa
  2283.     st.b    P61_plflag+1(a3)
  2284.     subq    #1,P61_plcount(a3)
  2285.     bra    P61_fxdone
  2286.  
  2287. P61_setloop
  2288.     tst.b    P61_plflag(a3)
  2289.     bne    P61_fxdone
  2290.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2291.     lea    P61_temp0+P61_TData(pc),a1
  2292.     lea    P61_looppos(pc),a0
  2293.     moveq    #channels-1,d0
  2294. .talt    move.l    (a1)+,(a0)+
  2295.     move.l    (a1)+,(a0)+
  2296.     move.l    (a1),(a0)+
  2297.     subq.l    #8,a1
  2298.     add.l    d6,a1
  2299.     dbf    d0,.talt
  2300.     bra    P61_fxdone
  2301.     endc
  2302.  
  2303.     ifne    P61_fvu
  2304. P61_finevup
  2305.     moveq    #$f,d0
  2306.     and.b    P61_Info(a5),d0
  2307.     add    d0,P61_Volume(a5)
  2308.     moveq    #64,d0
  2309.     cmp    P61_Volume(a5),d0
  2310.     bge    P61_fxdone
  2311.     move    d0,P61_Volume(a5)
  2312.     bra    P61_fxdone
  2313.     endc
  2314.  
  2315.     ifne    P61_fvd
  2316. P61_finevdwn
  2317.     moveq    #$f,d0
  2318.     and.b    P61_Info(a5),d0
  2319.     sub    d0,P61_Volume(a5)
  2320.     bpl    P61_fxdone
  2321.     clr    P61_Volume(a5)
  2322.     bra    P61_fxdone
  2323.     endc
  2324.  
  2325.     ifne    P61_timing
  2326. P61_sete8
  2327.     moveq    #$f,d0
  2328.     and.b    P61_Info(a5),d0
  2329.     move    d0,P61_E8(a3)
  2330.     bra    P61_fxdone
  2331.     endc
  2332.  
  2333.     ifne    P61_rt
  2334. P61_setretrig
  2335.     moveq    #$f,d0
  2336.     and.b    P61_Info(a5),d0
  2337.     move    d0,P61_RetrigCount(a5)
  2338.     bra    P61_fxdone
  2339.     endc
  2340.  
  2341.     ifne    P61_nd
  2342. P61_ndelay
  2343.     moveq    #$7e,d0
  2344.     and.b    (a5),d0
  2345.     beq    P61_skip
  2346.     ifne    P61_vib
  2347.     clr.b    P61_VibPos(a5)
  2348.     endc
  2349.     ifne    P61_tre
  2350.     clr.b    P61_TrePos(a5)
  2351.     endc
  2352.     ifne    P61_ft
  2353.     add    P61_Fine(a5),d0
  2354.     endc
  2355.     move    d0,P61_Note(a5)
  2356.     move    (a2,d0),P61_Period(a5)
  2357.     ifeq    fade
  2358.     move    P61_Volume(a5),8(a4)
  2359.     else
  2360.     move    P61_Volume(a5),P61_Shadow(a5)
  2361.     endc
  2362.     bra    P61_skip
  2363.     endc
  2364.  
  2365.     ifne    P61_pde
  2366. P61_pattdelay
  2367.     moveq    #$f,d0
  2368.     and.b    P61_Info(a5),d0
  2369.     move    d0,P61_pdelay(a3)
  2370.     st    P61_pdflag(a3)
  2371.     bra    P61_fxdone
  2372.     endc
  2373.  
  2374.     ifne    P61_sd
  2375. P61_cspeed
  2376.     moveq    #0,d0
  2377.     move.b    P61_Info(a5),d0
  2378.  
  2379.     ifne    CIA
  2380.     tst    P61_Tempo(a3)
  2381.     beq.b    P61_VBlank
  2382.     cmp.b    #32,d0
  2383.     bhs.b    P61_STempo
  2384.     endc
  2385.  
  2386. P61_VBlank
  2387.     cmp.b    #1,d0
  2388.     beq.b    P61_jkd
  2389.  
  2390.     move.b    d0,P61_speed+1(a3)
  2391.     subq.b    #1,d0
  2392.     move.b    d0,P61_speed2+1(a3)
  2393.     clr    P61_speedis1(a3)
  2394.     bra    P61_fxdone
  2395.  
  2396. P61_jkd    move.b    d0,P61_speed+1(a3)
  2397.     move.b    d0,P61_speed2+1(a3)
  2398.     st    P61_speedis1(a3)
  2399.     bra    P61_fxdone
  2400.  
  2401.  
  2402.     ifne    CIA
  2403. P61_STempo
  2404.     move.l    P61_timer(pc),d1
  2405.     divu    d0,d1
  2406.     move    d1,P61_thi2(a3)
  2407.     sub    #$1f0*2,d1
  2408.     move    d1,P61_thi(a3)
  2409.  
  2410.     ifeq    system
  2411.     move    P61_thi2(a3),d1
  2412.     move.b    d1,$bfd400
  2413.     lsr    #8,d1
  2414.     move.b    d1,$bfd500
  2415.     endc
  2416.  
  2417.     bra    P61_fxdone
  2418.     endc
  2419.     endc
  2420.  
  2421.  
  2422.  
  2423.     ifne    P61_vbvs
  2424. P61_vibochvslide
  2425.     move.b    P61_Info(a5),d0
  2426.     sub.b    d0,P61_Volume+1(a5)
  2427.     bpl.b    P61_test62
  2428.     clr    P61_Volume(a5)
  2429.     ifeq    fade
  2430.     clr    8(a4)
  2431.     else
  2432.     clr    P61_Shadow(a5)
  2433.     endc
  2434.     bra.b    P61_vib2
  2435. P61_test62
  2436.     moveq    #64,d0
  2437.     cmp    P61_Volume(a5),d0
  2438.     bge.b    .ncs2
  2439.     move    d0,P61_Volume(a5)
  2440. .ncs2    ifeq    fade
  2441.     move    P61_Volume(a5),8(a4)
  2442.     else
  2443.     move    P61_Volume(a5),P61_Shadow(a5)
  2444.     endc
  2445.     endc
  2446.  
  2447.     ifne    P61_vib
  2448. P61_vib2
  2449.     move    #$f00,d0
  2450.     move    P61_VibCmd(a5),d1
  2451.     and    d1,d0
  2452.     lsr    #3,d0
  2453.  
  2454.     lsr    #2,d1
  2455.     and    #$1f,d1
  2456.     add    d1,d0
  2457.  
  2458.     move    P61_Period(a5),d1
  2459.     moveq    #0,d2
  2460.     move.b    P61_vibtab(pc,d0),d2
  2461.  
  2462.     tst.b    P61_VibPos(a5)
  2463.     bmi.b    .vibneg
  2464.     add    d2,d1
  2465.     bra.b    P61_vib4
  2466.  
  2467. .vibneg    sub    d2,d1
  2468.  
  2469. P61_vib4
  2470.     move    d1,6(a4)
  2471.     move.b    P61_VibCmd(a5),d0
  2472.     lsr.b    #2,d0
  2473.     and    #$3c,d0
  2474.     add.b    d0,P61_VibPos(a5)
  2475.     bra    P61_contfxdone
  2476.     endc
  2477.  
  2478.     ifne    P61_tre
  2479. P61_tremo
  2480.     move    #$f00,d0
  2481.     move    P61_TreCmd(a5),d1
  2482.     and    d1,d0
  2483.     lsr    #3,d0
  2484.     
  2485.     lsr    #2,d1
  2486.     and    #$1f,d1
  2487.     add    d1,d0
  2488.  
  2489.     move    P61_Volume(a5),d1
  2490.     moveq    #0,d2
  2491.     move.b    P61_vibtab(pc,d0),d2
  2492.  
  2493.     tst.b    P61_TrePos(a5)
  2494.     bmi.b    .treneg
  2495.     add    d2,d1
  2496.     cmp    #64,d1
  2497.     ble.b    P61_tre4
  2498.     moveq    #64,d1
  2499.     bra.b    P61_tre4
  2500.  
  2501. .treneg    sub    d2,d1
  2502.     bpl.b    P61_tre4
  2503.     moveq    #0,d1
  2504. P61_tre4
  2505.     ifeq    fade
  2506.     move    d1,8(a4)
  2507.     else
  2508.     move    d1,P61_Shadow(a5)
  2509.     endc
  2510.  
  2511.     move.b    P61_TreCmd(a5),d0
  2512.     lsr.b    #2,d0
  2513.     and    #$3c,d0
  2514.     add.b    d0,P61_TrePos(a5)
  2515.     bra    P61_contfxdone
  2516.     endc
  2517.  
  2518.  
  2519.     ifne    P61_vib!P61_tre
  2520. P61_vibtab
  2521.     dc.w    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,$101,$101
  2522.     dc.w    $101,$101,$101,$101,$101,$101,$101,$101,$100,0,0
  2523.     dc.w    0,1,$101,$202,$203,$303,$303,$303,$303,$303,$303
  2524.     dc.w    $303,$202,$201,$101,0,0,$101,$202,$303,$404,$405
  2525.     dc.w    $505,$505,$505,$505,$505,$404,$403,$302,$201,$100
  2526.     dc.w    0,$102,$303,$405,$506,$607,$707,$707,$707,$707
  2527.     dc.w    $707,$606,$505,$403,$302,$100,0,$102,$304,$506
  2528.     dc.w    $707,$808,$909,$909,$909,$909,$908,$807,$706,$504
  2529.     dc.w    $302,$100,1,$203,$405,$607,$809,$90A,$B0B,$B0B
  2530.     dc.w    $B0B,$B0B,$B0A,$909,$807,$605,$403,$201,1,$204
  2531.     dc.w    $506,$708,$90A,$B0C,$C0D,$D0D,$D0D,$D0D,$C0C,$B0A
  2532.     dc.w    $908,$706,$504,$201,1,$304,$607,$80A,$B0C,$D0E
  2533.     dc.w    $E0F,$F0F,$F0F,$F0F,$E0E,$D0C,$B0A,$807,$604,$301
  2534.     dc.w    1,$305,$608,$90B,$C0D,$E0F,$1011,$1111,$1111
  2535.     dc.w    $1111,$100F,$E0D,$C0B,$908,$605,$301,1,$305,$709
  2536.     dc.w    $B0C,$E0F,$1011,$1213,$1313,$1313,$1313,$1211
  2537.     dc.w    $100F,$E0C,$B09,$705,$301,2,$406,$80A,$C0D,$F10
  2538.     dc.w    $1213,$1414,$1515,$1515,$1514,$1413,$1210,$F0D
  2539.     dc.w    $C0A,$806,$402,2,$406,$90B,$D0F,$1012,$1315,$1616
  2540.     dc.w    $1717,$1717,$1716,$1615,$1312,$100F,$D0B,$906
  2541.     dc.w    $402,2,$407,$90C,$E10,$1214,$1516,$1718,$1919
  2542.     dc.w    $1919,$1918,$1716,$1514,$1210,$E0C,$907,$402,2
  2543.     dc.w    $508,$A0D,$F11,$1315,$1718,$191A,$1B1B,$1B1B
  2544.     dc.w    $1B1A,$1918,$1715,$1311,$F0D,$A08,$502,2,$508
  2545.     dc.w    $B0E,$1012,$1517,$181A,$1B1C,$1D1D,$1D1D,$1D1C
  2546.     dc.w    $1B1A,$1817,$1512,$100E,$B08,$502
  2547.  
  2548.     endc
  2549.  
  2550.     ifne    P61_il
  2551. P61_funk
  2552.     moveq    #$f,d0
  2553.     and.b    P61_Info(a5),d0
  2554.     move.b    d0,P61_Funkspd(a5)
  2555.     bra    P61_fxdone
  2556.  
  2557. P61_funk2
  2558.     moveq    #0,d0
  2559.     move.b    P61_Funkspd(a5),d0
  2560.     beq.b    P61_funkend
  2561.     move.b    P61_FunkTable(pc,d0),d0
  2562.     add.b    d0,P61_Funkoff(a5)
  2563.     bpl.b    P61_funkend
  2564.     clr.b    P61_Funkoff(a5)
  2565.  
  2566.     move.l    P61_Sample(a5),a1
  2567.     move.l    P61_RepeatOffset(a1),d1
  2568.     move    P61_RepeatLength(a1),d0
  2569.     add.l    d0,d0
  2570.     add.l    d1,d0
  2571.     move.l    P61_Wave(a5),a0
  2572.     addq.l    #1,a0
  2573.     cmp.l    d0,a0
  2574.     blo.b    P61_funkok
  2575.     move.l    d1,a0
  2576. P61_funkok
  2577.     move.l    a0,P61_Wave(a5)
  2578.     not.b    (a0)
  2579. P61_funkend
  2580.     rts
  2581.  
  2582. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2583.     endc
  2584.  
  2585. P61_jtab
  2586.     dr    P61_fxdone
  2587.     dr    P61_fxdone
  2588.     dr    P61_fxdone
  2589.  
  2590.     ifne    P61_tp
  2591.     dr    P61_settoneport
  2592.     else
  2593.     dr    P61_fxdone
  2594.     endc
  2595.  
  2596.     ifne    P61_vib
  2597.     dr    P61_vibrato
  2598.     else
  2599.     dr    P61_fxdone
  2600.     endc
  2601.  
  2602.     ifne    P61_tpvs
  2603.     dr    P61_toponochange
  2604.     else
  2605.     dr    P61_fxdone
  2606.     endc
  2607.  
  2608.     dr    P61_fxdone
  2609.  
  2610.     ifne    P61_tre
  2611.     dr    P61_settremo
  2612.     else
  2613.     dr    P61_fxdone
  2614.     endc
  2615.  
  2616.     dr    P61_fxdone
  2617.  
  2618.     ifne    P61_sof
  2619.     dr    P61_sampleoffse
  2620.     else
  2621.     dr    P61_fxdone
  2622.     endc
  2623.     dr    P61_fxdone
  2624.  
  2625.     ifne    P61_pj
  2626.     dr    P61_posjmp
  2627.     else
  2628.     dr    P61_fxdone
  2629.     endc
  2630.  
  2631.     ifne    P61_vl
  2632.     dr    P61_volum
  2633.     else
  2634.     dr    P61_fxdone
  2635.     endc
  2636.  
  2637.     ifne    P61_pb
  2638.     dr    P61_pattbreak
  2639.     else
  2640.     dr    P61_fxdone
  2641.     endc
  2642.  
  2643.     ifne    P61_ec
  2644.     dr    P61_ecommands
  2645.     else
  2646.     dr    P61_fxdone
  2647.     endc
  2648.     
  2649.     ifne    P61_sd
  2650.     dr    P61_cspeed
  2651.     else
  2652.     dr    P61_fxdone
  2653.     endc
  2654.  
  2655.  
  2656. P61_dmason
  2657.     ifeq    system
  2658.     tst.b    $bfdd00
  2659.     move    #$2000,$dff09c
  2660.     move.b    #$19,$bfdf00
  2661.     move.l    a0,-(sp)
  2662.     move.l    P61_vektori(pc),a0
  2663.     move.l    P61_intaddr(pc),(a0)
  2664.     move.l    (sp)+,a0
  2665.     move    P61_dma(pc),$dff096
  2666.     nop
  2667.     rte
  2668.  
  2669.     else
  2670.  
  2671.     move    P61_dma(pc),$96(a6)
  2672.     lea    P61_server(pc),a3
  2673.     addq    #1,(a3)
  2674.     move.l    P61_craddr(pc),a0
  2675.     move.b    #$19,(a0)
  2676.     bra    P61_ohi
  2677.     endc
  2678.  
  2679.  
  2680. P61_setrepeat
  2681.     ifeq    system
  2682.     tst.b    $bfdd00
  2683.     movem.l    a0/a1,-(sp)
  2684.     lea    $dff0a0,a1
  2685.     move    #$2000,-4(a1)
  2686.     else
  2687.     lea    $a0(a6),a1
  2688.     endc
  2689.  
  2690.     move.l    P61_Sample+P61_temp0(pc),a0
  2691.     addq.l    #6,a0
  2692.     move.l    (a0)+,(a1)+
  2693.     move    (a0),(a1)
  2694.  
  2695.     ifgt    channels-1
  2696.     move.l    P61_Sample+P61_temp1(pc),a0
  2697.     addq.l    #6,a0
  2698.     move.l    (a0)+,12(a1)
  2699.     move    (a0),16(a1)
  2700.     endc
  2701.     
  2702.     ifgt    channels-2
  2703.     move.l    P61_Sample+P61_temp2(pc),a0
  2704.     addq.l    #6,a0
  2705.     move.l    (a0)+,28(a1)
  2706.     move    (a0),32(a1)
  2707.     endc
  2708.  
  2709.     ifgt    channels-3
  2710.     move.l    P61_Sample+P61_temp3(pc),a0
  2711.     addq.l    #6,a0
  2712.     move.l    (a0)+,44(a1)
  2713.     move    (a0),48(a1)
  2714.     endc
  2715.  
  2716.     ifne    system
  2717.     ifne    CIA
  2718.     lea    P61_server(pc),a3
  2719.     clr    (a3)
  2720.     move.l    P61_craddr+4(pc),a0
  2721.     move.b    P61_tlo(pc),(a0)
  2722.     move.b    P61_thi(pc),$100(a0)
  2723.     endc
  2724.     bra    P61_ohi
  2725.     endc
  2726.  
  2727.     ifeq    system
  2728.     ifne    CIA
  2729.     move.l    P61_vektori(pc),a0
  2730.     move.l    P61_tintti(pc),(a0)
  2731.     endc
  2732.     movem.l    (sp)+,a0/a1
  2733.     nop
  2734.     rte
  2735.     endc
  2736.  
  2737. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2738.         dc    1
  2739.  
  2740. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2741.         dc    2
  2742.  
  2743. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2744.         dc    4
  2745.  
  2746. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2747.         dc    8
  2748.  
  2749. P61_cn        dc    0
  2750. P61_dma        dc    $8200
  2751. P61_rowpos    dc    0
  2752. P61_slen    dc    0
  2753. P61_speed    dc    0
  2754. P61_speed2    dc    0
  2755. P61_speedis1    dc    0
  2756. P61_spos    dc.l    0
  2757.  
  2758.     ifeq    system
  2759. P61_vektori    dc.l    0
  2760. P61_oldlev6    dc.l    0
  2761.     endc
  2762.  
  2763. P61_ofilter    dc    0
  2764. P61_timers    dc.l    0
  2765.  
  2766.     ifne    CIA
  2767. P61_tintti    dc.l    0
  2768. P61_thi        dc.b    0
  2769. P61_tlo        dc.b    0
  2770. P61_thi2    dc.b    0
  2771. P61_tlo2    dc.b    0
  2772. P61_timer    dc.l    0
  2773.     endc
  2774.  
  2775.     ifne    P61_pl
  2776. P61_plcount    dc    0
  2777. P61_plflag    dc    0
  2778. P61_plreset    dc    0
  2779. P61_plrowpos    dc    0
  2780. P61_looppos    dcb.b    12*channels
  2781.     endc
  2782.  
  2783.     ifne    P61_pde
  2784. P61_pdelay    dc    0
  2785. P61_pdflag    dc    0
  2786.     endc
  2787.  
  2788. P61_samples    dcb.b    16*31
  2789. P61_emptysample    dcb.b    16
  2790. P61_positionbase dc.l    0
  2791. P61_possibase    dc.l    0
  2792. P61_patternbase    dc.l    0
  2793. P61_intaddr    dc.l    0
  2794.  
  2795.     ifne    system
  2796. P61_server    dc    0
  2797. P61_miscbase    dc.l    0
  2798. P61_audioopen    dc.b    0
  2799. P61_sigbit    dc.b    -1
  2800. P61_ciares    dc.l    0
  2801. P61_craddr    dc.l    0,0,0
  2802. P61_dat        dc    $f00
  2803. P61_timerinterrupt dc    0,0,0,0,127
  2804. P61_timerdata    dc.l    0,0,0
  2805. P61_timeron    dc    0
  2806. P61_allocport    dc.l    0,0
  2807.         dc.b    4,0
  2808.         dc.l    0
  2809.         dc.b    0,0
  2810.         dc.l    0
  2811. P61_reqlist    dc.l    0,0,0
  2812.         dc.b    5,0
  2813. P61_allocreq    dc.l    0,0
  2814.         dc    127
  2815.         dc.l    0
  2816. P61_portti    dc.l    0
  2817.         dc    68
  2818.         dc.l    0,0,0
  2819.         dc    0
  2820. P61_reqdata    dc.l    0
  2821.         dc.l    1,0,0,0,0,0,0
  2822.         dc    0
  2823. P61_audiodev    dc.b    'audio.device',0
  2824.  
  2825. P61_cianame    dc.b    'ciab.resource',0
  2826. P61_timeropen    dc.b    0
  2827. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2828.     endc
  2829. P61_etu
  2830.  
  2831.